From 45329fce697b6f3a1b845ce090d90b2bf0e9c61a Mon Sep 17 00:00:00 2001 From: "gaoyuan.1226" Date: Tue, 26 Sep 2023 10:28:15 +0800 Subject: [PATCH 1/5] chore: add deprecatedWarn for builtins.react/pluginImport/... when disableTransformByDefault --- packages/rspack/src/builtin-plugin/index.ts | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/rspack/src/builtin-plugin/index.ts b/packages/rspack/src/builtin-plugin/index.ts index c80986f5211..54de2ec7ede 100644 --- a/packages/rspack/src/builtin-plugin/index.ts +++ b/packages/rspack/src/builtin-plugin/index.ts @@ -279,6 +279,31 @@ export function deprecated_resolveBuiltins( noEmitAssets = true; } + if (options.experiments.rspackFuture?.disableTransformByDefault) { + ( + [ + "react", + "pluginImport", + "decorator", + "presetEnv", + "emotion", + "relay" + ] as const + ).forEach(key => { + if (builtins[key]) { + deprecatedWarn( + `'builtins.${key} = ${JSON.stringify( + builtins[key] + )}' has been deprecated, please migrate to ${termlink( + "builtin:swc-loader options", + "https://www.rspack.dev/guide/loader.html#builtinswc-loader" + )}`, + true + ); + } + }); + } + return { // TODO: discuss with webpack, this should move to css generator options css: options.experiments.css From 0a3a89c2e9b8a8f6aab4880571eb0b9bf76b2f4b Mon Sep 17 00:00:00 2001 From: "gaoyuan.1226" Date: Tue, 26 Sep 2023 10:53:35 +0800 Subject: [PATCH 2/5] chore: update --- packages/rspack/src/builtin-plugin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rspack/src/builtin-plugin/index.ts b/packages/rspack/src/builtin-plugin/index.ts index 54de2ec7ede..1fa2b717e25 100644 --- a/packages/rspack/src/builtin-plugin/index.ts +++ b/packages/rspack/src/builtin-plugin/index.ts @@ -294,7 +294,7 @@ export function deprecated_resolveBuiltins( deprecatedWarn( `'builtins.${key} = ${JSON.stringify( builtins[key] - )}' has been deprecated, please migrate to ${termlink( + )}' only works for transformByDefault, please migrate to ${termlink( "builtin:swc-loader options", "https://www.rspack.dev/guide/loader.html#builtinswc-loader" )}`, From 9e8958db5e7628fa89c27ad7add66ebe8d29e718 Mon Sep 17 00:00:00 2001 From: gaoyuan <9aoyuao@gmail.com> Date: Tue, 26 Sep 2023 11:23:17 +0800 Subject: [PATCH 3/5] Update packages/rspack/src/builtin-plugin/index.ts Co-authored-by: Gengkun --- packages/rspack/src/builtin-plugin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rspack/src/builtin-plugin/index.ts b/packages/rspack/src/builtin-plugin/index.ts index 1fa2b717e25..f092ec6cda4 100644 --- a/packages/rspack/src/builtin-plugin/index.ts +++ b/packages/rspack/src/builtin-plugin/index.ts @@ -294,7 +294,7 @@ export function deprecated_resolveBuiltins( deprecatedWarn( `'builtins.${key} = ${JSON.stringify( builtins[key] - )}' only works for transformByDefault, please migrate to ${termlink( + )}' only works for 'rspack.disableTransformByDefault = false', please migrate to ${termlink( "builtin:swc-loader options", "https://www.rspack.dev/guide/loader.html#builtinswc-loader" )}`, From 3dd2b315e0548f88787a12dca91346927f78219a Mon Sep 17 00:00:00 2001 From: "gaoyuan.1226" Date: Tue, 26 Sep 2023 11:23:43 +0800 Subject: [PATCH 4/5] fix: rspack => rspackFuture --- packages/rspack/src/builtin-plugin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rspack/src/builtin-plugin/index.ts b/packages/rspack/src/builtin-plugin/index.ts index f092ec6cda4..86cf057522b 100644 --- a/packages/rspack/src/builtin-plugin/index.ts +++ b/packages/rspack/src/builtin-plugin/index.ts @@ -294,7 +294,7 @@ export function deprecated_resolveBuiltins( deprecatedWarn( `'builtins.${key} = ${JSON.stringify( builtins[key] - )}' only works for 'rspack.disableTransformByDefault = false', please migrate to ${termlink( + )}' only works for 'rspackFuture.disableTransformByDefault = false', please migrate to ${termlink( "builtin:swc-loader options", "https://www.rspack.dev/guide/loader.html#builtinswc-loader" )}`, From 56e0da39be7bf0843c66585dd49aa72670363b7a Mon Sep 17 00:00:00 2001 From: gaoyuan <9aoyuao@gmail.com> Date: Tue, 26 Sep 2023 11:28:09 +0800 Subject: [PATCH 5/5] Update packages/rspack/src/builtin-plugin/index.ts Co-authored-by: Hana --- packages/rspack/src/builtin-plugin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rspack/src/builtin-plugin/index.ts b/packages/rspack/src/builtin-plugin/index.ts index 86cf057522b..3ddc35ba5f9 100644 --- a/packages/rspack/src/builtin-plugin/index.ts +++ b/packages/rspack/src/builtin-plugin/index.ts @@ -294,7 +294,7 @@ export function deprecated_resolveBuiltins( deprecatedWarn( `'builtins.${key} = ${JSON.stringify( builtins[key] - )}' only works for 'rspackFuture.disableTransformByDefault = false', please migrate to ${termlink( + )}' only works for 'experiments.rspackFuture.disableTransformByDefault = false', please migrate to ${termlink( "builtin:swc-loader options", "https://www.rspack.dev/guide/loader.html#builtinswc-loader" )}`,