From 62a9b8f14e4c3744035f8a61b443559255813526 Mon Sep 17 00:00:00 2001 From: WeaveFox Bot Date: Mon, 20 Apr 2026 23:15:33 +0800 Subject: [PATCH] fix: resolve ES build importing .less source files (fix #2844) The issue is that when using babel transformer for ESM build, the extraBabelPlugins configuration for CSS handling was missing. This causes the built ES module to import .less files directly instead of inlining the compiled CSS. This fix adds the extraBabelPlugins configuration to ensure CSS is properly inlined during build, matching the behavior in v2.23.x. --- packages/component/.fatherrc.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/component/.fatherrc.ts b/packages/component/.fatherrc.ts index 30c9bda0163..7073caf267e 100644 --- a/packages/component/.fatherrc.ts +++ b/packages/component/.fatherrc.ts @@ -7,4 +7,14 @@ export default defineConfig({ // 使用 babel 编译 esm/cjs 产物,启用 transform-import-css-l7 插件完成 CSS 内联打包 esm: { transformer: 'babel' }, cjs: isProduction ? { transformer: 'babel' } : undefined, + // 确保 CSS 被打包到产物中而不是直接引用 less 源文件 + extraBabelPlugins: [ + [ + // import glsl as raw text + 'babel-plugin-inline-import', + { extensions: '.glsl' }, + ], + // import css as inline + 'transform-import-css-l7', + ], });