Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack ERROR in multi ./src/index.js ./dist/bundle.js

Tags:

webpack

WARNING in configuration The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment. ERROR in multi ./src/index.js ./dist/bundle.js

like image 216
look4me Avatar asked Feb 27 '18 10:02

look4me


1 Answers

The following is the help message from webpack by typing webpack --help in webpack 4

Usage without config file: webpack <entry> [<entry>] --output [-o] <output>

Notice: --output need to be specified explicitly


Solution:

webpack src/index.js --output dist/bundle.js --mode development

And if you are using webpack.config.js :

const path = require('path');

module.exports = {
  mode: 'development',     // set mode option, 'development' or 'production'
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname,'dist'),
    filename: "bundle.js"
  }
};
like image 174
Neven.Leung Avatar answered Oct 11 '22 00:10

Neven.Leung