From 426f6bba333ffa060a89ca6234b5dc74a84a08f2 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Wed, 13 Nov 2024 10:51:40 +0000 Subject: [PATCH] fix(rspack): ensure swc provides react runtime automatically --- packages/rspack/src/plugins/utils/apply-base-config.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/rspack/src/plugins/utils/apply-base-config.ts b/packages/rspack/src/plugins/utils/apply-base-config.ts index 1a304534f255c..565a1422e5f71 100644 --- a/packages/rspack/src/plugins/utils/apply-base-config.ts +++ b/packages/rspack/src/plugins/utils/apply-base-config.ts @@ -404,11 +404,13 @@ function applyNxDependentConfig( }, transform: { react: { + runtime: 'automatic', pragma: 'React.createElement', pragmaFrag: 'React.Fragment', throwIfNamespace: true, // Config.mode is already set based on options.mode and `process.env.NODE_ENV` development: config.mode === 'development', + refresh: config.mode === 'development', useBuiltins: false, }, },