-
Notifications
You must be signed in to change notification settings - Fork 42
/
vue.config.js
118 lines (110 loc) · 3.02 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
const WorkerPlugin = require('worker-plugin')
const webpack = require('webpack')
module.exports = {
productionSourceMap: false,
chainWebpack: config => {
config.module
.rule('md')
.test(/\.md/)
.use('html-loader')
.loader('html-loader')
.tap(options => {
return { ...options, minimize: false }
})
.end()
config.resolve.symlinks(false)
config.output.globalObject('this')
config.module
.rule('flow')
.test(/\.flow$/)
.use('ignore-loader')
.loader('ignore-loader')
.end()
// This optimization comes from a long-standing bug with the terser webpack plugin
// documented here: https://github.com/webpack-contrib/terser-webpack-plugin/issues/143,
// and here: https://github.com/terser/terser/issues/571,
// and here: https://github.com/webpack-contrib/terser-webpack-plugin/issues/202
config.optimization.minimizer('terser').tap(args => {
args[0].terserOptions = {
terserOptions: {
parse: {
ecma: 8
},
compress: {
ecma: 5,
warnings: false,
comparisons: false,
inline: 2,
drop_console: true
},
mangle: {
safari10: true
},
output: {
ecma: 5,
comments: false,
ascii_only: true
}
},
parallel: 4, // This should be changed if we modify the resource class of the Circle jobs running the build step
cache: true,
sourceMap: false,
extractComments: false
}
return args
})
},
configureWebpack: {
optimization: {
splitChunks: {
chunks: 'all',
minSize: 30000,
maxSize: 1000000,
minChunks: 1,
maxAsyncRequests: 6,
maxInitialRequests: 4,
automaticNameDelimiter: '~',
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true
}
}
}
},
plugins: [
new WorkerPlugin({ sharedWorker: true }),
new webpack.ContextReplacementPlugin(
/moment[/\\]locale$/,
/en-au|en-ca|en-us|en-mx/
)
]
},
pluginOptions: {
lintStyleOnBuild: true,
stylelint: {},
apollo: {
lintGQL: true
},
webpackBundleAnalyzer: {
analyzerMode: 'disabled'
// you can uncomment this line, run npm build, this will generate dist/stats.json which can be viewed here
// https://chrisbateman.github.io/webpack-visualizer/
//generateStatsFile: true
}
},
// Adding this package specically because
// the source has 2 nullish coalscent references
// that babel isn't transpiling correctly otherwise
transpileDependencies: [
'@d3fc/d3fc-axis',
'graphql-language-service-interface',
'graphql-language-service-parser',
'graphql-language-service'
]
}