Webpack-dev-server 忽略 node_modules

Webpack-dev-server ignore node_modules

当 运行 webpack-dev-server 像这样:

webpack-dev-server --config ./webpack.config.dev.js

终端会像这样控制台,很多控制台。 怎么忽略node_modules?

bundle.js  4.11 MB       0  [emitted]  main
chunk    {0} bundle.js (main) 1.43 MB [rendered]
    [0] multi main 64 bytes {0} [built]
    [1] ./~/babel-polyfill/lib/index.js 907 bytes {0} [built]
    [2] ./~/core-js/shim.js 7.38 kB {0} [built]
    [3] ./~/core-js/modules/es6.symbol.js 8.93 kB {0} [built]
    ...
   [18] ./~/core-js/modules/_redefine.js 1.05 kB {0} [built]
   [19] ./~/core-js/modules/_uid.js 158 bytes {0} [built]
   [20] ./~/core-js/modules/_ctx.js 505 bytes {0} [built]
   [21] ./~/core-js/modules/_a-function.js 120 bytes {0} [built]
   ...
  [648] ./~/ansi-regex/index.js 135 bytes {0} [built]
  [649] (webpack)/hot/only-dev-server.js 2.25 kB {0} [built]
  [650] (webpack)/hot/log-apply-result.js 813 bytes {0} [built]

我修好了。在我的 webpack.config.dev.js 中添加这样的配置:

devServer: {
  stats: {
    chunks: false
  },
},