-
Notifications
You must be signed in to change notification settings - Fork 41
/
vue.config.js
87 lines (80 loc) · 2.54 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
const path = require('path')
const { defineConfig } = require('@vue/cli-service')
/**
* @type {import('@vue/cli-service').ProjectOptions}
*/
module.exports = defineConfig({
assetsDir: 'static',
publicPath: process.env.WGU_PUBLIC_PATH || './',
runtimeCompiler: true,
pages: {
app: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html',
title: 'Wegue WebGIS',
favicon: 'app/static/icon/favicon.ico'
},
embedded: {
entry: 'src/main.js',
template: 'public/embedded.html',
filename: 'embedded.html',
title: 'Wegue WebGIS Embedded',
favicon: 'app/static/icon/favicon.ico'
}
},
devServer: {
client: {
logging: 'warn',
overlay: {
warnings: false,
errors: true
}
},
hot: true,
host: '0.0.0.0',
port: 8081,
open: true
},
chainWebpack: config => {
config.resolve.alias.set('APP', path.resolve(config.resolve.alias.get('@'), '../app'))
return config
.plugin('copy')
.tap(options => {
options[0].patterns[0].from = path.resolve(options[0].patterns[0].from, '../app/static')
options[0].patterns[0].to = process.env.NODE_ENV === 'production'
? path.resolve(options[0].patterns[0].to, '../dist/static')
: 'static'
return options
})
},
configureWebpack: config => {
// Tweak configuration options for Karma test runner to produce a bundle
// which can run under Chrome headless. Avoid warnings due to custom entries
// and customized filenames. Enable correct code coverage of .vue files.
// Disable Vuetify treeshaking.
// Ensure build is sent to a temporary directory and keep only necessary plugins.
if (process.env.NODE_ENV === 'test') {
const PLUGINS_TO_KEEEP = [
'VueLoaderPlugin',
'DefinePlugin',
'CaseSensitivePathsPlugin',
'FriendlyErrorsWebpackPlugin'
]
config.devtool = 'eval'
config.optimization.runtimeChunk = false
config.optimization.splitChunks = false
config.plugins = config.plugins.filter(plugin =>
PLUGINS_TO_KEEEP.includes(plugin.constructor.name)
)
delete config.target
delete config.entry
delete config.output.filename
delete config.output.path
}
},
// Disable dependencies transpilation as browsers currently targetted by
// .browserlistrc doesn't need it anymore. If legacy browsers need to be supported
// modules to be processed can be granularly specified here.
transpileDependencies: false
})