Tag Archives: Module not found: Error: Can’t resolve ‘bundle.js’ in…

Module not found: Error: Can’t resolve ‘bundle.js’ in…

$ npm run build

> [email protected] build D:\work\git\simple-app-demo
> webpack app.js bundle.js

Hash: af174d80108e932cdc49
Version: webpack 4.29.3
Time: 319ms
Built at: 2019-02-15 10:52:12
 1 asset
Entrypoint main = main.js
[0] multi ./app.js bundle.js 40 bytes {0} [built]
[1] ./app.js 60 bytes {0} [built]
    + 1 hidden module

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'p    roduction' 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 ./app.js bundle.js
Module not found: Error: Can't resolve 'bundle.js' in 'D:\work\git\simple-app-demo'
 @ multi ./app.js bundle.js main[1]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack app.js bundle.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\\AppData\Roaming\npm-cache\_logs\2019-02-15T02_52_12_529Z-debug.log

An error is reported when webpack is executed. The solution is as follows:

Change the scripts command in package.json to:

"build": "webpack app.js -o bundle.js",