-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvue.config.js
149 lines (147 loc) · 3.98 KB
/
vue.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// const { VueLoaderPlugin } = require('vue-loader')
// require('ofe').call()
module.exports = {
configureWebpack: {
// optimization: {
// runtimeChunk: 'single',
// splitChunks: {
// cacheGroups: {
// vendor: {
// test: /[\\/]node_modules[\\/]/,
// name: 'vendors',
// chunks: 'all'
// }
// }
// }
// },
optimization: {
splitChunks: {
minSize: 10000,
maxSize: 250000
}
},
devServer: {
stats: {
chunks: false,
chunkModules: false,
modules: false
}
},
// devtool: "source-map",
devtool: "eval-source-map",
resolve: {
alias: {
// Include the vue compiler so mods can use templates
"vue$": "vue/dist/vue.esm.js",
"@/*": "./src/*"
}
},
module: {
rules: [{
test: /\.(?:js|mjs|cjs)$/,
exclude: {
and: [/node_modules/], // Exclude libraries in node_modules ...
not: []
},
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: "defaults" }]
],
plugins: [
'@babel/plugin-transform-nullish-coalescing-operator',
'@babel/plugin-transform-optional-chaining',
]
}
}
},
{
test: /\.node$/,
loader: "node-loader",
}
]
}
},
chainWebpack: config => {
if (process.env.ASSET_PACK_HREF) {
console.log("Replacing for asset href", process.env.ASSET_PACK_HREF)
const srl_options = options => {
return {
search: 'assets://',
replace: process.env.ASSET_PACK_HREF,
flags: 'g'
}
}
// config.module.rule('vue')
// .use('string-replace-loader')
// .loader('string-replace-loader')
// .before('cache-loader') // After css imports are resolved
// .tap(srl_options)
for (const rule of ['css', 'scss']) {
for (const oneOfCase of ['vue', 'vue-modules', 'normal', 'normal-modules']) {
// console.warn(oneOfCase)
config.module.rule(rule)
.oneOf(oneOfCase)
.use('string-replace-loader')
.loader('string-replace-loader')
.before('css-loader') // After css-loader processes imports (before means after)
.tap(srl_options)
}
}
}
},
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
// TEMPORARY: builds failing due to faulty minimization!
chainWebpackMainProcess: config => {
config.plugins.delete("uglify")
config.optimization.minimize(false)
},
// chainWebpackRendererProcess: config => {
// config.plugins.delete("uglify");
// config.optimization.minimize(false);
// },
builderOptions: {
appId: "com.bambosh.unofficialhomestuckcollection",
productName: "The Unofficial Homestuck Collection",
copyright: "Copyright © 2020-2022 Bambosh",
directories: {
buildResources: "build"
},
win: {
target: {
target: "zip",
arch: [
"x64",
"ia32"
]
},
artifactName: "${productName}-${version}-${os}-${arch}.${ext}",
asarUnpack: [
"**/node_modules/sharp/**",
"**/*.node"
]
},
mac: {
target: ["dmg"],
category: "entertainment",
identity: null,
asarUnpack: [
"**/node_modules/sharp/**",
"**/*.node"
]
},
linux: {
target: ["AppImage", "tar.gz"],
category: "game",
asarUnpack: [
"**/node_modules/sharp/**",
"**/*.node"
]
}
}
}
}
}