且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何提高webpack的性能?

更新时间:2022-04-17 01:16:06

/ code>装载机路径。例子:

You should set include paths for your loaders. Example:

{ test: /\.js$/, loader: 'jsx-loader', include: jsSrcPath }

考虑为css案例做同样的事情。

Consider doing the same for that css case.

按照我的经验,这可以带来巨大的收益,因为它不必再遍历 node_modules 。或者,您可以 exclude node_modules ,但我发现只需要设置 include code>。不过,如果您要求内容不在包含路径中,它会变得更加复杂。

In my experience this can give massive gains as it doesn't have to traverse through node_modules anymore. Alternatively you could exclude node_modules but I find it neater just to set up that include. It gets more complicated if you are requiring content out of the include path, though.

包含/排除文档