diff --git a/.changeset/thick-monkeys-call.md b/.changeset/thick-monkeys-call.md new file mode 100644 index 0000000000..3567c3eed2 --- /dev/null +++ b/.changeset/thick-monkeys-call.md @@ -0,0 +1,5 @@ +--- +'@ice/plugin-rax-compat': patch +--- + +fix: user compilation config lose diff --git a/packages/plugin-rax-compat/src/index.ts b/packages/plugin-rax-compat/src/index.ts index 43bf4ced5c..76e1e1f0ee 100644 --- a/packages/plugin-rax-compat/src/index.ts +++ b/packages/plugin-rax-compat/src/index.ts @@ -97,9 +97,14 @@ const plugin: Plugin = (options = {}) => ({ type: false, }); + // TODO: optimize the logic, support deep merge in plugin API. + // 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 || {}, {