构建新思路

This commit is contained in:
chenqiang 2025-09-09 05:45:44 +08:00
parent 15e4eec3eb
commit 6179410604
4 changed files with 9 additions and 8 deletions

View File

@ -1,3 +0,0 @@
// 这是一个简单的入口文件用于解决Electron Builder路径解析问题
// 它会直接引用background/main.js作为实际入口点
require('./background/main');

View File

@ -58,9 +58,9 @@ function buildPortableApp() {
process.env.WIN_CSC_LINK = '';
process.env.WIN_CSC_KEY_PASSWORD = '';
// 执行构建命令
// 执行构建命令 - 直接指定主入口文件
execSync(
'npm run electron:build -- --win portable --ia32 --x64 --publish never',
'npm run electron:build -- --win portable --ia32 --x64 --publish never --extra-resource=background',
{ stdio: 'inherit' }
);

View File

@ -4,7 +4,7 @@
"private": true,
"description": "统计技能考试系统",
"author": "抚顺市统计局",
"main": "index.js",
"main": "background/main.js",
"scripts": {
"start": "vue-cli-service electron:serve",
"serve": "vue-cli-service serve",

View File

@ -15,7 +15,6 @@ module.exports = {
preload: "src/preload.js",
mainProcessFile: "background/main.js",
lintPreloadFiles: false,
// 将externals改为数组格式
externals: ["fontkit", "pdfkit"],
chainWebpackMainProcess: (config) => {
config.module
@ -54,7 +53,12 @@ module.exports = {
// 针对Windows 7的特殊配置
extraResources: [
{
from: "background/font", // 更新为新路径
from: "background", // 包含整个background目录
to: "background",
filter: ["**/*"],
},
{
from: "background/font",
to: "font",
filter: ["**/*"],
},