Skip to content

fix(repack-plugin-nativewind): configure SWC rules nested in oneOf - #1494

Merged
dannyhw merged 3 commits into
callstack:mainfrom
whydidoo:fix/nativewind-swc-oneof
Oct 16, 2026
Merged

dannyhw merged 3 commits into
callstack:mainfrom
whydidoo:fix/nativewind-swc-oneof

Conversation

@whydidoo

Copy link
Copy Markdown
Collaborator

Related to #1422.

Summary

NativeWindPlugin only rewrote builtin:swc-loader rules at the top level of module.rules. getJsTransformRules nests them in oneOf, so importSource: 'nativewind' was never applied there and JSX kept importing from react.

 NativeWindPlugin.apply
-  module.rules.forEach(configure)          # top level only
+  configureRules(module.rules)             # recurses into oneOf / nested rules

The walker lives inside the plugin, so @callstack/repack gets no new public export. This part of the plugin is already marked "remove in 6.0".

Test plan

  • tests/integration/src/plugins/NativeWindPlugin.test.ts (Rspack): with getJsTransformRules() + NativeWindPlugin, every builtin:swc-loader, including those inside oneOf, gets importSource: 'nativewind'. It was red before the change (react).

NativeWindPlugin only updated top-level builtin:swc-loader rules, so with
getJsTransformRules (which nests them in oneOf) JSX kept importing from
`react`. Walk nested `oneOf` and `rules` as well.

Related to callstack#1422
@changeset-bot

changeset-bot Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3564505

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-plugin-nativewind Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack 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.

@dannyhw
dannyhw merged commit 87db9a1 into callstack:main Oct 16, 2026
3 of 4 checks passed
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.

3 participants