-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvue.config.js
More file actions
121 lines (110 loc) · 3.7 KB
/
Copy pathvue.config.js
File metadata and controls
121 lines (110 loc) · 3.7 KB
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
/*
* Copyright (c) 2020 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2024-06-15
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
const path = require('path')
const fs = require('fs')
const { gitDescribeSync } = require('git-describe')
process.env.VUE_APP_VERSION = require('./package.json').version
process.env.VUE_APP_GIT_COMMIT = gitDescribeSync().hash
module.exports = {
devServer: {
host: 'localhost',
https: {
key: fs.readFileSync('./.certs/localhost+1-key.pem'),
cert: fs.readFileSync('./.certs/localhost+1.pem'),
},
progress: false,
port: 8000,
headers: {
'Access-Control-Allow-Origin': '*',
},
proxy: {
'^/': {
changeOrigin: true,
target: process.env.VUE_APP_API,
},
},
},
chainWebpack: config => {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('scss').oneOf(type)))
config.module.rule('js').exclude.add(/\.worker\.js$/)
config.resolve.alias.set('@tests', path.resolve(__dirname, 'tests'))
config.when(process.env.NODE_ENV === 'development', config => {
// devtool
config.merge({
devtool: 'source-map',
})
})
config.when(process.env.NODE_ENV === 'production', config => {
/*
optimization in production mode only as unit testing is broken when
splitChunks is configured
*/
config.optimization.splitChunks({
chunks: 'all',
maxSize: 250000,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
)[1]
return `npm.${packageName.replace('@', '')}`
},
},
},
})
config.performance.hints(false)
})
config.module
.rule('worker-loader')
.test(/\.worker\.js$/)
.use('worker-loader')
.loader('worker-loader')
.options({
inline: true,
fallback: false,
name: '[name]:[hash:8].js',
})
.end()
config.resolve.modules.add(path.resolve('./src'), path.resolve('./node_modules'))
/*
To strip all locales except “en”, and ...
(“en” is built into Moment and can’t be removed)
*/
config.plugin('MomentLocalesPlugin').use(require('moment-locales-webpack-plugin'), [
{
localesToKeep: [], //e.g. 'ru', 'vi'
},
])
},
transpileDependencies: ['vuetify'],
outputDir: `${process.env.buildPath}/gui`,
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'locales',
enableInSFC: true,
},
},
productionSourceMap: false,
}
function addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [path.resolve(__dirname, './src/styles/constants.scss')],
})
}