webpack构建速度提升90%流畅度

yarn add hard-source-webpack-plugin

  

const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');

    plugins: [
      new HardSourceWebpackPlugin({
        cacheDirectory: 'node_modules/.cache/hard-source/[confighash]',
        recordsPath: 'node_modules/.cache/hard-source/[confighash]/records.json',
        configHash: function (webpackConfig) {
          return require('node-object-hash')({ sort: false }).hash(webpackConfig);
        },
        environmentHash: {
          root: process.cwd(),
          directories: [],
          files: ['package-lock.json', 'yarn.lock'],
        },
      }),
    ]

  

原文地址:https://www.cnblogs.com/uimeigui/p/12955129.html