exam11/vue.config.js
chenqiang 657d8df9fc win7
2025-09-09 02:52:00 +08:00

79 lines
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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和electron-builder 22.9.1
win: {
target: [
{
target: "portable",
arch: ["ia32", "x64"],
},
],
icon: "public/favicon.ico",
// 在electron-builder 22.9.1中compression选项应该在这里设置
// 删除了之前的错误配置
// 针对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",
},
// 在electron-builder 22.9.1中压缩配置应该在build选项中设置
builderOptions: {
compression: "store", // 等同于--no-compress不压缩应用
},
},
},
};