-
Notifications
You must be signed in to change notification settings - Fork 29
/
.fatherrc.ts
53 lines (51 loc) · 1.32 KB
/
.fatherrc.ts
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
import { defineConfig } from 'father';
import { IFatherBundlessConfig } from 'father/dist/types';
const less2CssConfig: IFatherBundlessConfig = {
transformer: 'babel', // 使用 babel 编译
extraBabelPlugins: [
[
'./scripts/babel-less-to-css.js', // 把文件中的 '.less' 字符转为 '.css'
{ test: '\\.less' },
],
],
};
export default defineConfig({
esm: {
output: 'es',
...less2CssConfig,
},
cjs: {
output: 'lib',
...less2CssConfig,
alias: {
// lodash-es 不支持 cjs 产物,将打包产物修改为从 lodash 引入
'lodash-es': 'lodash',
},
},
plugins: [
// less 编译为 css
'./scripts/father-plugin-less.js',
],
// https://github.com/umijs/father/blob/master/docs/config.md#umd
umd: {
name: 'LarkMap',
output: 'dist',
extractCSS: true,
externals: {
lodash: '_',
'lodash-es': '_',
react: 'React',
'react-dom': 'ReactDOM',
'@antv/l7': 'L7',
'@antv/l7-draw': { root: ['L7', 'Draw'], commonjs2: '@antv/l7-draw', commonjs: '@antv/l7-draw' },
},
chainWebpack(memo) {
memo
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [
{ analyzerMode: 'static', openAnalyzer: false },
]);
return memo;
},
},
});