Skip to content

fix: emit native injection code as CommonJS - #419

Open
shin4141 wants to merge 1 commit into
nativewind:mainfrom
shin4141:codex/fix-native-injection-cjs
Open

fix: emit native injection code as CommonJS#419
shin4141 wants to merge 1 commit into
nativewind:mainfrom
shin4141:codex/fix-native-injection-cjs

Conversation

@shin4141

Copy link
Copy Markdown

Summary

  • emit native injection code with CommonJS require() calls
  • preserve CSS side-effect loading and StyleCollection.inject behavior
  • add a regression that parses and executes the generated source in script mode

The synthetic module previously retained raw import / export syntax, which reaches Hermes unchanged when Expo's optimize-graph tree shaking is enabled.

Validation

  • focused regression: 1 test passed
  • full test suite: 56 suites passed (4 skipped), 1,052 tests passed (21 skipped)
  • yarn lint
  • yarn typecheck
  • yarn build
  • git diff --check

The exact Expo optimize-graph + Hermes export was not rerun locally; the regression directly covers the script-mode parse failure and the required module/injection behavior.

Closes #414.

AI assistance was used to inspect the issue, implement the focused change, and run validation. I reviewed the complete diff.

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.

Tree shaking: getNativeInjectionCode emits raw ESM, hermesc fails with 'requires module mode'

1 participant