mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
not leave require locale in dist files, close #3204
This commit is contained in:
parent
a987e34f6f
commit
d063ed4dca
@ -1,5 +1,11 @@
|
||||
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') {
|
||||
@ -8,6 +14,11 @@ module.exports = function (webpackConfig) {
|
||||
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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user