1.按照文档进行配置
// "hard-source-webpack-plugin": "^0.13.1", 依赖版本
const HardSourceWebpackPlugin = require("hard-source-webpack-plugin");
configureWebpack: (config) => {
....
config.plugins.push(new HardSourceWebpackPlugin());
....
}
2.在项目build的时候报了这个错误
因为该插件使用的是webpack5以下的版本。vue-cli5对应的是webpack5版本,所以会有这个报错。后来又看了一下webpack5的文档,本身支持cache的配置。
3.修改后的vue.congfig.js
type: 'memory' (简易类型,不允许有其他配置)
'filesystem'(可以有其他配置)
allowCollectingMemory:true (默认生产环境false,开发环境true)
....TODO