Skip to content

Commit a9a759d

Browse files
committed
Refactor rspack configuration in autoImport feature to streamline plugin appending process and ensure previous configurations are preserved.
1 parent 821298c commit a9a759d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/features/autoImport/autoImport.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,25 @@ export default (api: IApi) => {
8282
// Rsbuild 集成 (基于 Rspack)
8383
api.modifyRsbuildConfig((config: any) => {
8484
config.tools = config.tools || {};
85-
85+
8686
// 保存之前的配置函数
8787
const prevRspack = config.tools.rspack;
88-
88+
8989
config.tools.rspack = (rspackConfig: any, context: any) => {
9090
// 先执行之前的配置(如果存在)
9191
let resultConfig = rspackConfig;
9292
if (typeof prevRspack === 'function') {
9393
resultConfig = prevRspack(rspackConfig, context);
9494
}
95-
95+
9696
// 使用 appendPlugins 添加插件
9797
if (context && context.appendPlugins) {
9898
context.appendPlugins(AutoImportRspack(getAutoImportConfig()));
9999
}
100-
100+
101101
return resultConfig;
102102
};
103-
103+
104104
return config;
105105
});
106106
};

0 commit comments

Comments
 (0)