Closed tjl-with-code closed 3 years ago
我也遇到了这个问题,可能是一个bug,但可以解决
修改.electron-vue/webpack.web.config.js
和.electron-vue/webpack.renderer.config.js
,在文件里搜索index.html
字符串。
可以见到如下内容:
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({filename: 'styles.css'}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true
},
nodeModules: false
}),
修改为:
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin({filename: 'styles.css'}),
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
}),
我也是从百度搜索知道解决方案,可能是个bug。如果有兴趣,你可以使用英文重新提交一个issus,或者提交pr修复。
这个脚手架的包版本比较低,把node版本降到10.X也可以解决这个问题
@jack9603301 this fixes the problem, thanks. Can somebody fix this in this repo?
Maybe I can submit a pr
Patch has been submitted
It seems that my patch and #1020 are duplicated, I will close my pr
ReferenceError: process is not defined
index.ejs:11 eval [.]/[html-webpack-plugin]/lib/loader.js!./src/index.ejs:11:2
index.ejs:16 module.exports [.]/[html-webpack-plugin]/lib/loader.js!./src/index.ejs:16:3
index.js:284 [zhuyuzaixian]/[html-webpack-plugin]/index.js:284:18
runMicrotasks
task_queues.js:97 processTicksAndRejections internal/process/task_queues.js:97:5