electron-vue报错 ReferenceError: process is not defined
Vue 报错 not is Process defined electron
2023-09-11 14:22:30 时间
在使用electron-vue时,运行npm run dev出现如下错误
解决方式:
找到.electron-vue/webpack.web.config.js 和.electron-vue/webpack.renderer.config.js中的HtmlWebpackPlugin,添加templateParameters,修改后如下:
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: process.env.NODE_ENV !== 'production'
? path.resolve(__dirname, '../node_modules')
: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
参考:https://www.jianshu.com/p/d01d56c81fec
相关文章
- Vue_(Router路由)-vue-router路由的基本用法
- Vue -> 解决 vue-ueditor-wrap 不能显示的问题
- VUE - vue.runtime.esm.js?6e6d:619 [Vue warn]: Do not use built-in or reserved HTML elements as component i
- vue-导入静态文件
- Vue.js基础体验(一)
- vue-cli3实现分环境打包步骤(给不同的环境配置相对应的打包命令)
- [Vue @Component] Define Props on a Vue Class with vue-property-decorator
- Vue.js3: 页面打开前实现图片全部预加载(vue@3.2.33)
- vue.js3.2.6:路由处理404报错(vue-router@4.0.11)
- vue.js3.2.6:路由处理404报错(vue-router@4.0.11)
- vue路由报错export ‘default‘ (imported as ‘VueRouter‘) was not found in ‘vue-router‘
- npm 报错 request to https://registry.cnpmjs.org/vue failed, reason: Hostname/IP does not match certificate‘
- vue3 - 报错 ESLint: Component name "index" should always be multi-word.(vue/multi-word-component-names)
- vue 请求报错 Network Error ,没有其他报错信息-解决
- vue - public 引入 <script>报错 Uncaught SyntaxError: Unexpected token '<'
- Springboot+Vue实现将图片和表单一起提交到后端,同时将图片地址保存到数据库、再次将存储的图片展示到前端vue页面
- 088:vue+openlayers实时显示单个卫星的位置及轨迹 (示例代码)
- 040:vue+openlayers导出GeoJSON格式文件(代码示例)
- Vue项目运行后控制台报错Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘
- Vue: vue-router路由