-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
55 lines (55 loc) · 2.01 KB
/
webpack.config.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
43
44
45
46
47
48
49
50
51
52
53
54
55
const path = require('path');
const DllPlugin = require('webpack/lib/DllPlugin');
const root = process.cwd();
const rimraf = require('rimraf');
rimraf(path.join(root, 'template/library'), () => { });
module.exports = {
mode: 'production',
entry: {
react: ['react', 'react-dom', 'react-router', 'react-router-dom'],
core: ['ims-core', 'lodash'],
antd: ['antd'],
polyfill: ['@babel/polyfill'],
bizcharts: ['bizcharts'],
dataSet: ['@antv/data-set'],
antDesignIcons: ['@ant-design/icons'],
moment: ['moment']
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
mainFields: ['main:h5', 'main', 'module'],
symlinks: true,
modules: [path.join(root, 'packages'), path.join(root, 'node_modules')]
},
output: {
filename: '[name].dll.js',
path: path.resolve(root, 'attachment/template/library'),
library: '_dll_[name]', //dll的全局变量名
},
module: {
rules: [{
test: /\.tsx?$/,
use: [{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react'],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx',
"@babel/plugin-syntax-import-meta",
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }],
"@babel/plugin-proposal-json-strings"
]
}
}]
}]
},
plugins: [
new DllPlugin({
name: '_dll_[name]', //dll的全局变量名
path: path.join(root, 'attachment/template/library', '[name].manifest.json'),//描述生成的manifest文件
})
]
}