mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
25 lines
812 B
JavaScript
25 lines
812 B
JavaScript
const webpack = require('webpack');
|
|
const getWebpackConfig = require('antd-tools/lib/getWebpackConfig');
|
|
|
|
function ignoreMomentLocale(webpackConfig) {
|
|
delete webpackConfig.module.noParse;
|
|
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
|
|
}
|
|
|
|
module.exports = function (webpackConfig) {
|
|
webpackConfig = getWebpackConfig(webpackConfig);
|
|
if (process.env.RUN_ENV === 'PRODUCTION') {
|
|
// Fix ie8 compatibility
|
|
webpackConfig[0].module.loaders.unshift({
|
|
test: /\.(tsx|jsx?)$/,
|
|
loader: 'es3ify-loader',
|
|
});
|
|
// noParse still leave `require('./locale' + name)` in dist files
|
|
// ignore is better
|
|
// http://stackoverflow.com/q/25384360
|
|
ignoreMomentLocale(webpackConfig[0]);
|
|
ignoreMomentLocale(webpackConfig[1]);
|
|
}
|
|
return webpackConfig;
|
|
};
|