77 lines
2.0 KiB
JavaScript
77 lines
2.0 KiB
JavaScript
module.exports = {
|
|
// 添加应用标题配置
|
|
chainWebpack: config => {
|
|
config
|
|
.plugin('html')
|
|
.tap(args => {
|
|
args[0].title = '统计技能考试系统'
|
|
return args
|
|
})
|
|
},
|
|
pluginOptions: {
|
|
electronBuilder: {
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
preload: 'src/preload.js',
|
|
mainProcessFile: 'src/background/main.js',
|
|
lintPreloadFiles: false,
|
|
// 将externals改为数组格式
|
|
externals: ['fontkit', 'pdfkit'],
|
|
chainWebpackMainProcess: (config) => {
|
|
config.module
|
|
.rule('babel')
|
|
.test(/\.js$/)
|
|
.use('babel-loader')
|
|
.loader('babel-loader')
|
|
.options({
|
|
presets: ['@babel/preset-env'],
|
|
plugins: [
|
|
'@babel/plugin-proposal-optional-chaining',
|
|
'@babel/plugin-proposal-class-properties'
|
|
]
|
|
})
|
|
.end()
|
|
|
|
// 添加对mjs文件的处理 - 兼容Electron 11
|
|
config.module
|
|
.rule('mjs')
|
|
.test(/\.mjs$/)
|
|
.include
|
|
.add(/node_modules/)
|
|
.end()
|
|
.type('javascript/auto')
|
|
},
|
|
// Windows 7便携应用配置 - 兼容Electron 11
|
|
win: {
|
|
target: [
|
|
{
|
|
target: 'portable',
|
|
arch: ['ia32', 'x64']
|
|
}
|
|
],
|
|
icon: 'public/favicon.ico',
|
|
// 关闭压缩以提高在Windows 7上的兼容性
|
|
compression: 'store',
|
|
// 针对Windows 7的特殊配置
|
|
extraResources: [
|
|
{
|
|
from: 'src/background/font',
|
|
to: 'font',
|
|
filter: ['**/*']
|
|
},
|
|
{
|
|
from: 'data',
|
|
to: 'data',
|
|
filter: ['.gitignore']
|
|
}
|
|
]
|
|
},
|
|
// 便携应用配置 - 兼容Electron 11
|
|
portable: {
|
|
artifactName: '统计技能考试系统_便携版_${version}_${arch}.exe',
|
|
// 启用便携模式标志
|
|
target: 'portable'
|
|
}
|
|
}
|
|
}
|
|
} |