-
Notifications
You must be signed in to change notification settings - Fork 1
/
vue.config.js
123 lines (119 loc) · 3.15 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
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const PUBLIC_PATH = process.env.VUE_APP_PUBLIC_PATH || '/';
function decodeParseProxyURL(url) {
const proxyURL = decodeURIComponent(url.replace(/^\/proxy\/(.+)$/, '$1'));
return new URL(proxyURL);
}
module.exports = {
publicPath: PUBLIC_PATH,
pluginOptions: {
i18n: {
enableInSFC: false
}
},
parallel: false,
configureWebpack: {
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
node: {
global: true
},
resolve: {
fallback: {
fs: false,
http: false,
https: false,
zlib: false,
url: false,
Buffer: false
},
mainFields: ['module', 'main'],
alias: {
'@root': __dirname // Used to import tailwind config in component
}
},
module: {
unknownContextCritical: false,
unknownContextRegExp: /\/cesium\/cesium\/Source\/Core\/buildModuleUrl\.js/,
rules: [
{
test: /\.(png|gif|jpg|jpeg|svg|xml|json|czml|glb)$/,
include: path.resolve(__dirname, 'node_modules/cesium/Source'),
use: ['url-loader']
},
{
// Strip cesium pragmas
test: /\.js$/,
enforce: 'pre',
include: path.resolve(__dirname, 'node_modules/cesium/Source'),
sideEffects: false,
use: [{
loader: 'strip-pragma-loader',
options: {
pragmas: {
debug: false
}
}
}]
}
]
},
optimization: {
usedExports: true,
splitChunks: {
cacheGroups: {
default: false,
vendors: false,
cesium: {
test: /[\\/]node_modules[\\/]cesium/,
name: 'cesium',
chunks: 'all'
}
}
}
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'node_modules/cesium/Build/Cesium/Workers', to: 'Workers' },
{ from: 'node_modules/cesium/Build/Cesium/ThirdParty', to: 'ThirdParty' },
{ from: 'node_modules/cesium/Build/Cesium/Assets', to: 'Assets' },
{ from: 'node_modules/cesium/Build/Cesium/Widgets', to: 'Widgets' }
] }),
new webpack.DefinePlugin({
// Define relative base path in cesium for loading assets
CESIUM_BASE_URL: JSON.stringify('/embed/')
})
]
},
chainWebpack: config => {
// SVG Loader
config.module
.rule('svg')
.test(/\.svg(\?.*)?$/)
.use('svg-transform-loader')
.loader('svg-transform-loader')
.end();
},
devServer: {
proxy: {
'/proxy/*': {
logLevel: 'silent',
target: 'http://localhost', // dummy value
router: (req) => {
const url = decodeParseProxyURL(req.url);
return url.origin;
},
pathRewrite: (path, req) => {
const url = decodeParseProxyURL(req.url);
return url.pathname + url.search;
}
}
}
},
transpileDependencies: [/node_modules(?:\/|\\)lit-element|lit-html/]
};