I am following the tutorial exactly as given here . But I am amazed that the docs seems outdated. e.g
npx webpack src/index.js dist/bundle.js
fails with
Got the same issue and after a bit of research found its a problem to be fixed as you can see on this Github thread
One of the options:
Inside package.json set scripts
to either development
or production
mode
"scripts": {
"dev": "webpack --mode development",
"build": "webpack --mode production"
}
And now when you run npm run dev
it will give you bundle.js
but not minified.
But when you run npm run build
it will give you a minified bundle