Peeper
Peeper

Reputation: 382

Webpack can't find webpack.config.js

Webpack 2.2.0 is giving me this error when I try to run an npm script:

No configuration file found and no output filename configured via CLI option.

I've made sure that webpack.config.js is in the src folder.

module.exports = {
entry: './src/app.js',
output: {
    filename: './dist/app.bundle.js'
   }
}

enter image description here

Here is my project structure.

I appreciate any assistance.

Upvotes: 6

Views: 30178

Answers (1)

Tom Van Rompaey
Tom Van Rompaey

Reputation: 3586

You have 2 solutions:

  • move webpack.config.js to the root folder instead of ./src (pointed out by Jared Farrish)
  • use the --config attribute with the CLI that points to ./src/webpack.config.js: webpack --config src/webpack.config.js

Upvotes: 12

Related Questions