-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.all.js
37 lines (32 loc) · 1.03 KB
/
webpack.all.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
// / <reference types="./nodejs.d.ts" />
const path = require('path');
const merge = require('webpack-merge');
const common = require('./webpack.common');
/** @type { import("webpack").Configuration } */
const prodConfig = merge(common, {
mode: 'production',
entry: path.join(__dirname, 'src', 'core', 'index'),
output: {
filename: 'aol.all.min.js',
},
// optimization: {
// minimize: false,
// },
externals: [
// 引入包里的特定部分
function(context, request, callback) {
// 所有 ol 包里的内容
if (/^ol\/?/.test(request)) {
// console.log(request);
// https://segmentfault.com/q/1010000021965610?_ea=33440450
// https://blog.meathill.com/fe-tool-chain/webpack-4-notes.html
/** 先关闭webgl */
const exclude = ['ol/layer/WebGLPoints', 'ol/tilegrid/TileGrid'];
if (exclude.includes(request)) return callback();
return callback(null, request.replace(/\//g, '.'));
}
callback();
},
],
});
module.exports = prodConfig;