Package.json has scripts:

"build": "webpack-dev-server" ,

"build_p": "webpack-dev-server -p "

So npm run build - it is normal:

enter image description here

and with npm run build_p - an error saying something scary about UglifyJs:

enter image description here

Here is the contents of package.json :

 { "name": "test123", "version": "1.0.0", "description": "webpack123", "main": "app.js", "scripts": { "start": "webpack-dev-server --entry ./src/js/app.js --output-filename ./dist/bundle.js", "build": "webpack-dev-server", "build_p": "webpack-dev-server -p" }, "author": "", "license": "ISC", "dependencies": { "jquery": "^3.2.1", "webpack": "^3.9.0" }, "devDependencies": { "babel": "^6.23.0", "babel-core": "^6.26.0", "babel-loader": "^7.1.2", "babel-minify-webpack-plugin": "^0.2.0", "babel-preset-es2015": "^6.24.1", "css-loader": "^0.28.7", "style-loader": "^0.19.0", "webpack-dev-server": "^2.9.5" } } 

webpack.config.js content:

 const webpack = require("webpack"); const MinifyPlugin = require("babel-minify-webpack-plugin"); module.exports = { entry: "./src/js/app.js", output: { path: __dirname + "/dist", filename: "bundle.js" }, watch: true, module: { loaders: [ {test: /\.css$/, loader: "style-loader!css-loader"}, {test: /\.js$/, loader: "babel-loader", exclude: /node_modules/, query: {presets: ["es2015"]}} ] }, plugins: [ new MinifyPlugin({ // ... }) ] }; 

Perhaps this is somehow related to the Babel Minify plugin, but I do not really understand how.

Who will say what?

  • one
    So why do you run the server in production mode? - Igor Golovin
  • one
    And the minification in dev mode is also not clear why, you will have to restart the project for 30 seconds. - Igor Golovin
  • one
    And in the loader, not the query , but the options , the babel preset does not work for you. - Igor Golovin
  • @IgorGolovin yes, I understand you .. just just starting to dig into it all and try everything and everything .. and about "query" - this is from some lesson from the unfortunate teacher I have left .. I just looked in the documentation , there really is "options" instead of "query" .. the question is - do you know normal resources (except for documentation) from the webpack? or just documentation? - 1px_solid_black
  • @IgorGolovin and more interested in the question on the plugin .. namely, UglifyJsPlugin ... I had errors because of it .. it was useful to search for info through Google .. and there many people write that this is a problem in this plugin, they say it's time to abandon it .. what can you say about this? - 1px_solid_black

0