From 8914a46c40ff11acc7fa1e90b78727d13be8020d Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Mon, 17 Nov 2025 19:21:17 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- craco.config.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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(