-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathvue.config.js
93 lines (86 loc) · 2.01 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
const path = require('path'),
WorkerPlugin = require('worker-plugin');
module.exports = {
parallel: false,
crossorigin: 'anonymous',
integrity: true,
pwa: {
name: 'Sia Lite Wallet',
themeColor: '#1d1e21',
msTileColor: '#1d1e21',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black-translucent',
manifestOptions: {
background_color: '#1d1e21',
skylink: 'AQD-AsRr6-cB_xKegTR_7d0Dtzh73VPR08MGiEZgQ7Edxw'
}
},
configureWebpack: {
plugins: [
new WorkerPlugin()
],
optimization: {
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
maxSize: 200000,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return `npm.${packageName.replace('@', '')}`;
}
}
}
}
},
module: {
rules: [
{
test: /\.wasm$/,
loader: 'file-loader',
type: 'javascript/auto',
options: {
name: '[name].[contenthash].[ext]'
}
}
]
}
},
chainWebpack: config => {
config.output.publicPath = `${process.cwd()}/dist/`;
const svgRule = config.module.rule('svg');
const types = ['vue-modules', 'vue', 'normal-modules', 'normal'];
svgRule.uses.clear();
svgRule
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: false
});
types.forEach(type => addStyleResource(config.module.rule('stylus').oneOf(type)));
/*
Disable (or customize) prefetch, see:
https://cli.vuejs.org/guide/html-and-static-assets.html#prefetch
*/
config.plugins.delete('prefetch');
/*
Configure preload to load all chunks
NOTE: use `allChunks` instead of `all` (deprecated)
*/
config.plugin('preload').tap((options) => {
options[0].include = 'allChunks';
return options;
});
}
};
function addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/styles/vars.styl')
]
});
}