高版本的node(我是v12.9.1),大于12的版本時(shí)候芙扎。使用electron-vue項(xiàng)目時(shí)候會(huì)報(bào)錯(cuò)星岗!
?解決方案:修改 .electron-vue/webpack.renderer.config.js?和webpack.web.config.js
如下:webpack.web.config.js
new HtmlWebpackPlugin({
? ? ? filename: 'index.html',
? ? ? template: path.resolve(__dirname, '../src/index.ejs'),
? ? ? templateParameters(compilation, assets, options) {
? ? ? ? return {
? ? ? ? ? compilation: compilation,
? ? ? ? ? webpack: compilation.getStats().toJson(),
? ? ? ? ? webpackConfig: compilation.options,
? ? ? ? ? htmlWebpackPlugin: {
? ? ? ? ? ? files: assets,
? ? ? ? ? ? options: options
? ? ? ? ? },
? ? ? ? ? process,
? ? ? ? };
? ? ? },
? ? ? minify: {
? ? ? ? collapseWhitespace: true,
? ? ? ? removeAttributeQuotes: true,
? ? ? ? removeComments: true
? ? ? },
? ? ? nodeModules: false
? ? }),
如下: webpack.render.config.js
new HtmlWebpackPlugin({
? ? ? filename: 'index.html',
? ? ? template: path.resolve(__dirname, '../src/index.ejs'),
? ? ? minify: {
? ? ? ? collapseWhitespace: true,
? ? ? ? removeAttributeQuotes: true,
? ? ? ? removeComments: true
? ? ? },
? ? ? templateParameters(compilation, assets, options) {
? ? ? ? return {
? ? ? ? ? compilation: compilation,
? ? ? ? ? webpack: compilation.getStats().toJson(),
? ? ? ? ? webpackConfig: compilation.options,
? ? ? ? ? htmlWebpackPlugin: {
? ? ? ? ? ? files: assets,
? ? ? ? ? ? options: options
? ? ? ? ? },
? ? ? ? ? process,
? ? ? ? };
? ? ? },
? ? ? nodeModules: process.env.NODE_ENV !== 'production'
? ? ? ? ? path.resolve(__dirname, '../node_modules')
? ? ? ? : false
? ? }),