Skip to content

Fix/1422 swc jsx development - #1493

Open
whydidoo wants to merge 3 commits into
callstack:mainfrom
whydidoo:fix/1422-swc-jsx-development
Open

whydidoo wants to merge 3 commits into
callstack:mainfrom
whydidoo:fix/1422-swc-jsx-development

Conversation

@whydidoo

Copy link
Copy Markdown
Collaborator

Part of #1422.

Summary

getSwcLoaderOptions (used by getJsTransformRules) set jsc.transform.react.development from the JSX runtime instead of the build mode. As a result:

  • dev builds on the default automatic runtime emitted jsx instead of jsxDEV, so they had no __source/__self, accurate component stacks or "open in editor";
  • classic production builds kept the dev transforms.
 getSwcLoaderOptions
-  react.development = jsxRuntime === 'classic'
+  react.development = options.development   # only when passed explicitly
 RepackPlugin.apply
+  builtin:swc-loader rules (incl. oneOf / nested rules) without explicit `development`
+    → development = mode === 'development'
  • New development option on getSwcLoaderOptions and getJsTransformRules({ swc: { development } }).
  • Dev builds now import <importSource>/jsx-dev-runtime. If a custom importSource doesn't ship it, set swc: { development: false }.

Test plan

  • tests/integration/src/plugins/RepackPlugin.test.ts (Rspack): with getJsTransformRules() + RepackPlugin, development mode gives true, production gives false, and an explicit development: false is kept. These were red before the change.

getSwcLoaderOptions tied jsc.transform.react.development to the JSX
runtime, so development builds with the default automatic runtime emitted
`jsx` instead of `jsxDEV` and lost __source/__self, accurate component
stacks and "open in editor", while classic production builds kept them.

Config helpers don't know the mode, so RepackPlugin now sets `development`
from `mode` for every builtin:swc-loader rule that doesn't set it
explicitly. getSwcLoaderOptions and getJsTransformRules accept a
`development` option to override it.

Part of callstack#1422
Development builds now import `<importSource>/jsx-dev-runtime`; document
the `development: false` override for import sources without it and that
the mode-based default comes from RepackPlugin.

Part of callstack#1422
@changeset-bot

changeset-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6266878

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 10, 2026

Copy link
Copy Markdown

@whydidoo is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant