Skip to content

Commit

Permalink
chore: add builtins.react/... only works for transformByDefault tip (#…
Browse files Browse the repository at this point in the history
…4249)

* chore: add deprecatedWarn for builtins.react/pluginImport/... when disableTransformByDefault

* chore: update

* Update packages/rspack/src/builtin-plugin/index.ts

Co-authored-by: Gengkun <[email protected]>

* fix: rspack => rspackFuture

* Update packages/rspack/src/builtin-plugin/index.ts

Co-authored-by: Hana <[email protected]>

---------

Co-authored-by: Gengkun <[email protected]>
Co-authored-by: Hana <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2023
1 parent 775ffc8 commit ddb16e4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/rspack/src/builtin-plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)}' only works for 'experiments.rspackFuture.disableTransformByDefault = false', 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
Expand Down

0 comments on commit ddb16e4

Please sign in to comment.