Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 684
Peeper Avatar asked Sep 04 '26 10:09

Peeper


1 Answers

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
like image 51
Tom Van Rompaey Avatar answered Sep 07 '26 00:09

Tom Van Rompaey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!