Describe the bug
Using npm run dev with the latest [email protected] results in an error not found in @4.2.0
What is the current behavior?
[email protected] dev C:\Users\project\
webpack --mode development ./src/frontend/src/index.js -o ./src/frontend/static/frontend/
Debugger attached.
[webpack-cli] Running multiple commands at the same time is not possible
[webpack-cli] Found commands: 'build', './src/frontend/src/index.js'
[webpack-cli] Run 'webpack --help' to see available commands and options
Waiting for the debugger to disconnect...
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] dev:webpack --mode development ./src/frontend/src/index.js -o ./src/frontend/static/frontend/
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
To Reproduce
Steps to reproduce the behavior:
package.json
"scripts": {
"dev": "webpack --mode development --watch ./src/frontend/src/index.js -o > ./src/frontend/static/frontend/"
}
Expected behavior
Debugger attached.
[email protected] dev C:\Users\project\
webpack --mode development --watch ./src/frontend/src/index.js -o ./src/frontend/static/frontend/
Debugger attached.
[webpack-cli] Compilation starting...
(node:11956) ExperimentalWarning: Package name self resolution is an experimental feature. This feature could change at any time
[BABEL] Note: The code generator has deoptimised the styling of C:\Users\project\node_modules\react-dom\cjs\react-dom.development.js as it exceeds the max of 500KB.
[webpack-cli] Compilation finished
asset main.js 1.06 MiB [compared for emit] (name: main)
runtime modules 1.25 KiB 5 modules
modules by path ./node_modules/ 979 KiB 61 modules
modules by path ./src/frontend/src/ 8.45 KiB
modules by path ./src/frontend/src/components/ 6.47 KiB 3 modules
modules by path ./src/frontend/src/reducers/.js 1.57 KiB 3 modules
modules by path ./src/frontend/src/.js 410 bytes
./src/frontend/src/index.js 35 bytes [built] [code generated]
./src/frontend/src/store.js 375 bytes [built] [code generated]
./src/frontend/src/actions/types.js 1 bytes [built] [code generated]
webpack 5.19.0 compiled successfully in 3944 ms
[webpack-cli] watching files for updates...
Screenshots
Additional context
[email protected] is working perfectly.
Update webpack-cli to 4.5 and please use this syntax:
webpack ./src/frontend/src/index.js --mode development -o ./src/frontend/static/frontend/
webpack ./src/frontend/src/index.js --mode development --watch -o ./src/frontend/static/frontend/
Why? Because some options can be array, so webpack --target node ./file.js means target: ['node', './file.js']
Thanks! It is working now after updating to 4.5.0