Issues with getting started with webpack 4

前端 未结 6 561
抹茶落季
抹茶落季 2020-12-14 16:21

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

6条回答
  •  春和景丽
    2020-12-14 16:30

    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

提交回复
热议问题