Electron+vue学习2-asar
学习环境
- vue版本
@vue/cli 5.0.8
- nodejs版本
v16.17.1
- electron版本
13.0.0
实现asar:false
场景:打包后public文件夹被electron封装到asar中,无法读取内容
解决方法:修改vue.config.js文件中的如下代码
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
// 修改如下
builderOptions: {
asar:false
}
}
}
})
最后public变成了app文件夹,如下图所示