-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
74 lines (70 loc) · 1.8 KB
/
webpack.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
const path = require('path')
const webpack = require('webpack')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = (env, argv) => {
// minify in production
let filename = 'vue2mapbox-gl.js'
if (argv.mode === 'production') {
filename = 'vue2mapbox-gl.min.js'
}
return {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: filename,
library: 'vue2MapboxGl',
libraryTarget: 'umd'
},
externals: {
// don't include lodash in the bundle, rename to lodash
lodash: {
commonjs: 'lodash',
commonjs2: 'lodash',
amd: 'lodash',
root: '_'
},
'mapbox-gl': {
umd: 'mapbox-gl',
root: 'mapbox-gl',
global: 'mapbox-gl',
commonjs2: 'mapbox-gl',
commonjs: 'mapbox-gl',
amd: 'mapbox-gl'
},
'@mapbox/mapbox-gl-geocoder': {
umd: '@mapbox/mapbox-gl-geocoder',
root: '@mapbox/mapbox-gl-geocoder',
global: '@mapbox/mapbox-gl-geocoder',
commonjs2: '@mapbox/mapbox-gl-geocoder',
commonjs: '@mapbox/mapbox-gl-geocoder',
amd: '@mapbox/mapbox-gl-geocoder'
},
'vue': {
umd: 'Vue',
global: 'Vue',
root: 'Vue',
commonjs2: 'vue',
commonjs: 'vue',
amd: 'vue'
}
},
module: {
rules: [
// Load vue files
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
// make sure to include the plugin!
new VueLoaderPlugin(),
new BundleAnalyzerPlugin({analyzerMode: 'static'}),
new webpack.SourceMapDevToolPlugin({
filename: "[file].map"
})
]
}
}