-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
51 lines (45 loc) · 1.46 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
import AntDesignThemePlugin from 'antd-theme-webpack-plugin';
import MergeLessPlugin from './scripts/mergeLessPlugin';
const path = require('path');
export default (webpackConfig) => {
// 将所有 less 合并为一个供 themePlugin使用
const outFile = path.join(__dirname, `.${path.sep}.temp${path.sep}ant-design-pro.less`);
const stylesDir = path.join(__dirname, `.${path.sep}src${path.sep}`);
const mergeLessPlugin = new MergeLessPlugin({
stylesDir,
outFile,
});
const options = {
antDir: path.join(__dirname, './node_modules/antd'),
stylesDir,
varFile: path.join(__dirname, './src/themes/light/light.style.less'),
mainLessFile: outFile,
themeVariables: [
'@tabs-card-head-background',
'@primary-color',
'@text-white',
'@text-color',
'@text-color-secondary',
'@commonLightColor',
'@alertdarkfontColor',
'@border-radius-base',
'@border-color-base',
'@border-color-split',
'@body-background',
'@background-color-light',
'@component-background',
'@layout-body-background',
'@table-header-bg',
'@tabs-card-active-color',
],
indexFileName: 'index.html',
// publicPath: '/HiatmpPro',
generateOnce: false,
lessUrl: './less.min.js',
};
const themePlugin = new AntDesignThemePlugin(options);
// in config object
webpackConfig.plugins.push(mergeLessPlugin);
webpackConfig.plugins.push(themePlugin);
return webpackConfig;
};