1
hejianhao
2024-12-31 4d151a9bd66df24c33d7cf35ba5c6b593f1bdf79
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  devServer: {
    client: {
      overlay: false
    },
    proxy: { //开发环境代理配置
      "/api": {
        target: "http://192.168.110.34:9090",
        changeOrigin: true,
        pathRewrite: {
          "^/api": "/api"
        }
      },
    }
  },
  transpileDependencies: true,
  pluginOptions: {
    electronBuilder: {
      customFileProtocol: "./",
      nodeIntegration: true,
      preload: 'src/preload.js',
      externals: [
        "core-js",
        "electron-log",
        "qrcode",
        "soap",
        "view-design",
        "vue",
        "vue-router",
        "vuex",
        "x2js",
        "@rongcloud/electron",
        "@rongcloud/engine",
        "@rongcloud/imlib-next",
        "@rongcloud/electron-renderer",
        "@rongcloud/imkit",
        "axios",
        "element-ui",
        "js-md5",
        "js-pinyin",
        "moment",
        // "register-service-worker",
      ],
      builderOptions: {
        appId: "com.example.app",
        buildDependenciesFromSource: true,
        // "asarUnpack": [
        //     "./node_modules/java",
        //     "./node_modules/async",
        // ],
        asar: "false",
        productName: "scan", //项目名,也是生成的安装文件名,即aDemo.exe
        copyright: "Copyright © 2020", //版权信息
        directories: {
          // output: "./dist", //输出文件路径
        },
        win: {
          //win相关配置
          icon: "./public/logo.png", //图标,当前图标在根目录下,注意这里有两个坑
          target: [
            {
              target: "nsis", //利用nsis制作安装程序
              arch: [
                "x64", //64位
                "ia32", //32位
              ],
            },
          ],
        },
        mac: {
          target: ["dmg", "zip"],
        },
        // "linux": {
        //     "icon": "./public/favicon.ico"
        // },
        nsis: {
          oneClick: false, // 是否一键安装
          allowElevation: true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。
          allowToChangeInstallationDirectory: true, // 允许修改安装目录
          createDesktopShortcut: true, // 创建桌面图标
          createStartMenuShortcut: true, // 创建开始菜单图标
          shortcutName: "scan", // 图标名称
        },
      },
    },
  },
  chainWebpack(config) {
    config.module
      .rule("vue")
      .use("vue-loader")
      .tap((options) => {
        options.compilerOptions = {
          ...options.compilerOptions,
          isCustomElement: (tag) => {
            return (
              ["conversation-list", "message-list", "message-editor"].indexOf(
                tag
              ) !== -1
            );
          },
        };
        return options;
      })
      .end();
  },
});