forked from ant-design/ant-design-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
29 lines (26 loc) · 924 Bytes
/
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
const getWebpackConfig = require('antd-tools/lib/getWebpackConfig');
const pxtorem = require('postcss-pxtorem');
const Visualizer = require('webpack-visualizer-plugin');
const configSvg = require('./svg.config');
const pkg = require('./package.json');
module.exports = function (webpackConfig) {
// fix `npm run dist` sourceMap error, do not know the reason
delete webpackConfig.ts.compilerOptions.sourceMap;
webpackConfig = getWebpackConfig(webpackConfig, true);
if (!Array.isArray(webpackConfig)) {
webpackConfig = [webpackConfig, webpackConfig];
}
webpackConfig.forEach((config, index) => {
config.postcss.push(pxtorem({
rootValue: 100,
propWhiteList: [],
}));
configSvg(config);
if (index === 0) {
config.plugins.push(new Visualizer({
filename: `../ant-design-analysis/${pkg.name}@${pkg.version}-stats.html`,
}));
}
});
return webpackConfig;
};