Skip to content

Commit 4198bb9

Browse files
修复 maplibre 打包大小以及js版本错误 review by luox
1 parent 7a703dd commit 4198bb9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

build/webpack.config.maplibregl.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const productName = 'iclient-maplibregl';
66

77
module.exports = {
88
target: configBase.target,
9-
mode: 'development' || configBase.mode,
10-
devtool: 'inline-cheap-module-source-map',
9+
mode: configBase.mode,
1110
//页面入口文件配置
1211
entry: configBase.entry,
1312
//入口文件输出配置
@@ -21,8 +20,14 @@ module.exports = {
2120

2221
externals: Object.assign({}, configBase.externals, {
2322
'maplibre-gl': 'maplibregl',
24-
three: 'THREE',
25-
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()'
23+
three: 'function(){try{return THREE}catch(e){return {}}}()',
24+
'deck.gl': '(function(){try{return DeckGL}catch(e){return {}}})()',
25+
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
26+
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
27+
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
28+
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
29+
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()',
30+
'xml-js': 'function(){try{return convert}catch(e){return {}}}()'
2631
}),
2732

2833
module: {
@@ -32,7 +37,7 @@ module.exports = {
3237
moduleRules.push(configBase.module.rules.img);
3338
const babelConfig = {
3439
test: [/\.js$/],
35-
include: /node_modules[\/\\](proj4|maplibre-gl)/,
40+
exclude: /node_modules[\/\\]proj4|classic|webgl-debug/,
3641
loader: 'babel-loader',
3742
options: {
3843
presets: ['@babel/preset-env'],
@@ -46,12 +51,11 @@ module.exports = {
4651
regenerator: true,
4752
useESModules: false
4853
}
49-
],
50-
'@babel/plugin-proposal-nullish-coalescing-operator'
54+
]
5155
]
5256
}
5357
};
54-
configBase.moduleVersion === 'es6';
58+
configBase.moduleVersion === 'es6' && (babelConfig.include = /FGBLayer|flatgeobuf/);
5559
moduleRules.push(babelConfig);
5660
moduleRules.push(configBase.module.rules.css);
5761
return moduleRules;

0 commit comments

Comments
 (0)