-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
42 lines (37 loc) · 1.12 KB
/
webpack.dev.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
// / <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: 'development',
entry: path.join(__dirname, 'src', 'index'),
output: {
filename: 'aol.js',
},
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
// inline: true,
// compress: true,
host: '127.0.0.1',
port: 8080,
open: true,
},
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 (request === exclude[1]) return callback();
return callback(null, request.replace(/\//g, '.'));
}
callback();
},
],
});
module.exports = prodConfig;