search

Home  >  Q&A  >  body text

javascript - Deploying webpack online, prompting Uncaught Error: Cannot find module "—progress"

I am deploying JS files packaged by webpack, and the language used is vue.js. There is no problem when running locally, but when I deploy it to Jenkins, the build work also reports no errors. But when it is opened using an online address, it will always prompt Uncaught Error: Cannot find module "—progress". I checked online for a long time and still don't know what this error is.

The writing in 'scripts' in the package.json file is:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "webpack-dev-server --inline",
    "dev": "cross-env NODE_ENV=development webpack-dev-server -open -inline -hot",
    "build": "cross-env NODE_ENV=production webpack"
  }

If anyone knows how to solve it, please help me. This problem has been bothering me for a few days. . Thanks.

Post the webpack.config.js file:

const webpack = require("webpack");
const path = require("path");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
    entry : './src/main',
    output : { //出口文件
        path : path.join(__dirname,'./dist'),
        filename : "[name].js",
        publicPath : "/dist/"
    },
    module : {
        //定义了对模块的处理逻辑
        loaders : [
            {test : /\.js$/, loader : "babel-loader", exclude : /node_modules/},
            {test : /\.vue$/, loader : "vue-loader"},
            {test : /\.css$/, loader : "style-loader!css-loader"},
            {test : /\.scss/, loader : "style-loader!css-loader!sass-loader"},
            {test : /\.(html|tpl)$/, loader : 'html-loader' }
        ]
    },
    devServer : {
        historyApiFallback : true,
        inline : true,
        hot : false,
        host : "0.0.0.0"
    },
    devtool : 'cheap-module-eval-source-map',
    resolve : {
        // require时省略的扩展名,如:require('module') 不需要module.js
        extensions: ['.js', '.vue','.css'],
        // 别名,可以直接使用别名来代表设定的路径以及其他
        alias: {
            components: path.join(__dirname, './src/components')
        }
    },
    plugins : [
        new webpack.LoaderOptionsPlugin({
            options : {
                babel : {
                    presets: ['es2015']
                }
            }
        }),
        new ExtractTextPlugin('[name].css'),
        new webpack.ProvidePlugin({
            jQuery : "jquery",
            $ : "jquery"
        })
    ]
};
迷茫迷茫2701 days ago1518

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-07-05 10:52:02

    First you have to locate this progress to a specific file. It may be in the file webpack.config.js. You can post it

    reply
    0
  • Cancelreply