HardSourceWebpackPlugin 插件 不能提升第一次构建的速度,但对于第二次构建能提升99%的构建速度
第一次构建:
第二次:
提升了。。,算不出来,反正就是很多啦~~~
npm install --save hard-source-webpack-plugin
// webpack.config.js var HardSourceWebpackPlugin = require(‘hard-source-webpack-plugin‘); new HardSourceWebpackPlugin({ // Either an absolute path or relative to webpack‘s options.context. cacheDirectory: ‘node_modules/.cache/hard-source/[confighash]‘, // Either an absolute path or relative to webpack‘s options.context. // Sets webpack‘s recordsPath if not already set. recordsPath: ‘node_modules/.cache/hard-source/[confighash]/records.json‘, // Either a string of object hash function given a webpack config. configHash: function(webpackConfig) { // node-object-hash on npm can be used to build this. return require(‘node-object-hash‘)({sort: false}).hash(webpackConfig); }, // Either false, a string, an object, or a project hashing function. environmentHash: { root: process.cwd(), directories: [], files: [‘package-lock.json‘, ‘yarn.lock‘], }, }),
https://github.com/mzgoddard/hard-source-webpack-plugin