该脚手架基于 VueCli4 、 vue-cli-plugin-electron-builder,用于快速构建 Vue 桌面端应用。
yarn run serve
yarn run electron:serve
yarn run build
yarn run electron:build
module.exports = {
// 其他配置
chainWebpack: config => {},
pluginOptions: {
electronBuilder: {
chainWebpackMainProcess: config => {},
chainWebpackRendererProcess: config => {
config.plugin('define').tap(args => {
const env = args[0]['process.env']
for (let key in env) {
args[0][`process.env.${key}`] = env[key]
}
delete args[0]['process.env']
return args
})
}
}
}
}
获取对应配置文件赋予的值
桌面端: 当前用户目录下的 .vue-conf/config.json
Web 端: 项目目录下的 public/config/config.json