From cf1c496e01b07d79dbea00ef209870c381a301ba Mon Sep 17 00:00:00 2001 From: luhc228 Date: Mon, 9 Oct 2023 18:05:37 +0800 Subject: [PATCH] fix: user compilation config lose --- packages/plugin-rax-compat/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugin-rax-compat/src/index.ts b/packages/plugin-rax-compat/src/index.ts index 43bf4ced5c..48dcd1c970 100644 --- a/packages/plugin-rax-compat/src/index.ts +++ b/packages/plugin-rax-compat/src/index.ts @@ -97,9 +97,13 @@ const plugin: Plugin = (options = {}) => ({ type: false, }); + // Must create a variable to store the original compilationConfig. + const originalSwcCompilationConfig = typeof config.swcOptions?.compilationConfig === 'object' + ? cloneDeep(config.swcOptions?.compilationConfig || {}) + : {}; const compilationConfigFunc = typeof config.swcOptions?.compilationConfig === 'function' ? config.swcOptions?.compilationConfig - : () => config.swcOptions?.compilationConfig; + : () => originalSwcCompilationConfig; // Reset jsc.transform.react.runtime to classic. config.swcOptions = merge(config.swcOptions || {}, {