forked from MapGIS/WebClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapbox-plugin-debug-config.js
More file actions
61 lines (59 loc) · 1.96 KB
/
mapbox-plugin-debug-config.js
File metadata and controls
61 lines (59 loc) · 1.96 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
var webpack = require('webpack');
var path = require('path');
var HappyPack = require('happypack');//多线程loader 加快编译速度
var os = require('os');
var happyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length });
var HtmlWebpackPlugin = require('html-webpack-plugin');
const BuildInfo = require('./version/version.js')
module.exports = {
mode:'development',
devtool: 'eval-source-map',
entry: path.join(__dirname, '.', 'mapbox_main.js'),
output: {
path: path.join(__dirname, '.', 'output'),//打包后的文件存放的地方
filename: "webclient-mapboxgl-plugin.js"//打包后输出文件的文件名
},
externals: {
'@mapgis/mapbox-gl': 'mapboxgl',
'mapv': "function(){try{return mapv}catch(e){return {}}}()",
'echarts': 'function(){try{return echarts}catch(e){return {}}}()'
},
module: {
// noParse: /[\/\\]mapbox-gl\.js$/,
// noParse: /3rdLib[^.*mapbox]\.js$/,
//script-loader
rules: [
{
test: /(\.js)$/,
use: 'happypack/loader?id=js',
exclude: [/node_modules/,/leaflet/,/openlayers/]
}
]
},
plugins: [
new HappyPack({
id: 'js',
// threads: 4,
threadPool: happyThreadPool,
loaders: [{
loader: 'babel-loader',
options: {
presets: ['es2015'],
cacheDirectory: true,
plugins: ['transform-runtime', 'transform-decorators-legacy', 'transform-class-properties']
}
}]
}),
new HtmlWebpackPlugin({
filename: 'webclient-mapboxgl-plugin.html',
template: 'src/config/opensource/version/version.html',
inject: false,//不插入生成的js 仅用于版本声明
minify: {
removeComments: false,
collapseWhitespace: true,
removeAttributeQuotes: true
},
buildInfo: BuildInfo
})
]
}