diff --git a/craco.config.js b/craco.config.js index 946850d5..a39c59f5 100644 --- a/craco.config.js +++ b/craco.config.js @@ -69,7 +69,7 @@ module.exports = { }, // 日期/日历库 calendar: { - test: /[\\/]node_modules[\\/](moment|date-fns|@fullcalendar|react-big-calendar)[\\/]/, + test: /[\\/]node_modules[\\/](dayjs|date-fns|@fullcalendar|react-big-calendar)[\\/]/, name: 'calendar-lib', priority: 18, reuseExistingChunk: true, @@ -161,13 +161,8 @@ module.exports = { ); } - // 忽略 moment 的语言包(如果项目使用了 moment) - webpackConfig.plugins.push( - new webpack.IgnorePlugin({ - resourceRegExp: /^\.\/locale$/, - contextRegExp: /moment$/, - }) - ); + // Day.js 的语言包非常小(每个约 0.5KB),所以不需要特别忽略 + // 如果需要优化,可以只导入需要的语言包 // ============== Loader 优化 ============== const babelLoaderRule = webpackConfig.module.rules.find(