Warm tip: This article is reproduced from serverfault.com, please click

Webpack 4 : ERROR in Entry module not found: Error: Can't resolve './src'

发布于 2018-04-11 10:36:48

I was trying to run webpack-4 first time

webpack ./src/js/app.js ./dist/app.bundle.js

it shows warning / error :

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in multi ./src/js/app.js ./dist/app.bundle.js
Module not found: Error: Can't resolve './dist/app.bundle.js' in 'D:\wamp64\www\webpack-4'
 @ multi ./src/js/app.js ./dist/app.bundle.js

Then i tried to change the mode

webpack --mode development

it shows :

ERROR in Entry module not found: Error: Can't resolve './src'
Questioner
Sabir Hussain
Viewed
0
1,001 2018-08-17 20:01:02

Resolved

Spent a lot of time to find out the solution.

Solution: Add index.js file into src folder.

That's it!.. solved :)


During Research, I found some facts about webpack 4 :

webpack 4 doesn’t need a configuration file by default!

webpack 4 there is no need to define the entry point: it will take ./src/index.js as the default!