|
| 1 | +const configBase = require('./webpack.config.base'); |
| 2 | +//端名 |
| 3 | +const libName = 'maplibregl'; |
| 4 | +//产品包名 |
| 5 | +const productName = 'iclient-maplibregl'; |
| 6 | + |
| 7 | +module.exports = { |
| 8 | + target: configBase.target, |
| 9 | + mode: 'development' || configBase.mode, |
| 10 | + devtool: 'inline-cheap-module-source-map', |
| 11 | + //页面入口文件配置 |
| 12 | + entry: configBase.entry, |
| 13 | + //入口文件输出配置 |
| 14 | + output: configBase.output(libName, productName), |
| 15 | + //是否启用压缩 |
| 16 | + optimization: configBase.optimization, |
| 17 | + //不显示打包文件大小相关警告 |
| 18 | + performance: configBase.performance, |
| 19 | + //其它解决方案配置 |
| 20 | + resolve: configBase.resolve, |
| 21 | + |
| 22 | + externals: Object.assign({}, configBase.externals, { |
| 23 | + 'maplibre-gl': 'maplibregl', |
| 24 | + '@antv/l7': 'L7', |
| 25 | + three: 'THREE', |
| 26 | + 'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()' |
| 27 | + }), |
| 28 | + |
| 29 | + module: { |
| 30 | + noParse: /[\/\\]node_modules[\/\\]maplibre-gl[\/\\]dist[\/\\]maplibre-gl\.js$/, |
| 31 | + rules: (function () { |
| 32 | + let moduleRules = []; |
| 33 | + moduleRules.push(configBase.module.rules.img); |
| 34 | + const babelConfig = { |
| 35 | + test: [/\.js$/], |
| 36 | + include: /node_modules[\/\\](proj4|@antv[\/\\]l7|maplibre-gl)/, |
| 37 | + loader: 'babel-loader', |
| 38 | + options: { |
| 39 | + presets: ['@babel/preset-env'], |
| 40 | + plugins: [ |
| 41 | + [ |
| 42 | + '@babel/plugin-transform-runtime', |
| 43 | + { |
| 44 | + absoluteRuntime: false, |
| 45 | + corejs: false, |
| 46 | + helpers: false, |
| 47 | + regenerator: true, |
| 48 | + useESModules: false |
| 49 | + } |
| 50 | + ], |
| 51 | + '@babel/plugin-proposal-nullish-coalescing-operator' |
| 52 | + ] |
| 53 | + } |
| 54 | + }; |
| 55 | + configBase.moduleVersion === 'es6'; |
| 56 | + moduleRules.push(babelConfig); |
| 57 | + moduleRules.push(configBase.module.rules.css); |
| 58 | + return moduleRules; |
| 59 | + })() |
| 60 | + }, |
| 61 | + plugins: configBase.plugins(libName, productName) |
| 62 | +}; |
0 commit comments