8 Star 25 Fork 8

ant-motion / ant-motion

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 868 Bytes
一键复制 编辑 原始数据 按行查看 历史
jljsj33 提交于 2019-02-15 16:10 . update bisheng
/* eslint no-param-reassign: 0 */
// This config is for building dist files
const getWebpackConfig = require('antd-tools/lib/getWebpackConfig');
const { webpack } = getWebpackConfig;
// noParse still leave `require('./locale' + name)` in dist files
// ignore is better: http://stackoverflow.com/q/25384360
function ignoreMomentLocale(webpackConfig) {
delete webpackConfig.module.noParse;
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
}
function externalMoment(config) {
config.externals.moment = {
root: 'moment',
commonjs2: 'moment',
commonjs: 'moment',
amd: 'moment',
};
}
const webpackConfig = getWebpackConfig(false);
if (process.env.RUN_ENV === 'PRODUCTION') {
webpackConfig.forEach((config) => {
ignoreMomentLocale(config);
externalMoment(config);
});
}
module.exports = webpackConfig;
JavaScript
1
https://gitee.com/ant-motion/ant-motion.git
git@gitee.com:ant-motion/ant-motion.git
ant-motion
ant-motion
ant-motion
master

搜索帮助