forked from trueleaf/moyu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshare.config.js
124 lines (123 loc) · 4.13 KB
/
share.config.js
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* eslint-disable @typescript-eslint/no-var-requires */
/**
* @description electron默认打包配置
* @author shuxiaokai
*/
const path = require("path");
module.exports = {
pages: {
index: {
entry: "src/renderer/pages/modules/apidoc/doc-view/main.ts",
template: "public/index.html",
},
},
//=====================================devserver====================================//
devServer: {
port: 9999,
},
//=====================================css相关配置====================================//
css: {
loaderOptions: {
css: {
// 这里的选项会传递给 css-loader
},
sass: {
prependData: `@import "@/scss/index.scss";`,
},
},
sourceMap: false,
},
//=====================================扩展webpack配置====================================//
configureWebpack: {
resolve: {
alias: {
"@": path.resolve(__dirname, "../src/renderer"),
"@@": path.resolve(__dirname, "../src"),
"~": path.resolve(__dirname, "../"),
},
},
target: "web",
},
pluginOptions: {
electronBuilder: {
// contextIsolation: false,
nodeIntegration: true, //参考https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html
extends: null,
externals: [
"vue",
"axios",
"vue-electron",
"vue-router",
"vuex",
"vuex-electron",
"element-ui",
"js-cookie",
"mockjs",
"nprogress",
"monaco-editor",
"vuedraggable",
"ali-oss",
"json5",
"echarts",
"brace",
"urllib",
"got",
"@koa/cors",
"form-data",
"proxy-agent",
"shelljs",
"ssh2",
"koa",
"ip",
],
mainProcessFile: "src/main/background.ts",
mainProcessWatch: ["src/main/background.ts"],
builderOptions: {
productName: "moyu",
appId: "com.example.yourapp",
publish: [
{
provider: "generic",
url: "",
},
],
nsis: {
oneClick: false, // 是否一键安装
allowToChangeInstallationDirectory: true, // 允许修改安装目录
},
mac: {
icon: "public/icons/icon.icns",
},
win: {
icon: "public/icons/icon.ico",
},
linux: {
icon: "public/icons",
},
},
//参考 https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/1432
chainWebpackMainProcess: (config) => {
config.module
.rule("babel")
.before("ts")
.use("babel")
.loader("babel-loader")
.options({
presets: [
[
"@babel/preset-env",
{ modules: false, targets: { electron: "6" } },
],
],
plugins: ["@babel/plugin-proposal-class-properties"],
});
},
},
},
//=====================================eslint配置====================================//
lintOnSave: "error", //未通过eslint 禁止代码提交
//=====================================打包上线配置====================================//
publicPath: "/",
outputDir: "dist", //输出文件类型
productionSourceMap: false, //打包时候js是否添加sourceMap
};