Skip to content
Advertisement

npx webpack command cannot find module webpack.config.js

I’m following the official Webpack getting started guide and I get an error on the Using a Configuration section. It says to create a webpack.config.js file with:

JavaScript

I then run the following command: npx webpack --config webpack.config.js

The error I get is:

Cannot find module '/Users/Documents/Web_Development/tone/webpack.config.js'

The guide does not seem to give any ideas of what could be wrong here. Also my code editor is telling me there is an error with const path = require('path'); saying “Expected a JSON Object, array or literal;

My Directory structure:

JavaScript

package.json:

JavaScript

Advertisement

Answer

The solution was to change the webpack.config.json file to webpack.config.js.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement