Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip compiling fabric view as react native freaks out #720

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

satya164
Copy link
Member

@satya164 satya164 commented Dec 6, 2024

fixes #719

packages/react-native-builder-bob/package.json Outdated Show resolved Hide resolved
Comment on lines 68 to 71
// Let React Native preset handle the commonjs transform
// Otherwise this causes issues with `@react-native/babel-plugin-codegen`
supportsStaticESM: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the problem here?

Copy link
Member Author

@satya164 satya164 Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbroma codegen generates export in invalid position after the file is transformed to commonjs, which causes a syntax error when running the code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CJS transform comes from @babel/preset-env and codegen runs as a plugin and the order of execution should be plugins -> presets, this shouldnt be a problem 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the codegen plugin runs as part of the react native preset and presets run in the reverse order iirc, which means codegen plugin will run after preset-env

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the codegen plugin runs as part of the react native preset and presets run in the reverse order iirc, which means codegen plugin will run after preset-env

but we don't use the RN preset here? and codegen plugin shouldn't run twice since we strip the types here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbroma it is used in ...defaultConfig where example app passes the RN preset. codegen only runs as part of the RN preset.

@satya164 satya164 force-pushed the @satya164/codegen-plugin branch 3 times, most recently from fac2fe2 to a45b237 Compare December 6, 2024 16:49
@satya164 satya164 changed the title fix: use project's codegen plugin for babel fix: skip compiling fabric view as react native freaks out Dec 6, 2024
@satya164 satya164 force-pushed the @satya164/codegen-plugin branch from a45b237 to f6ec3f9 Compare December 6, 2024 16:50
@satya164 satya164 force-pushed the @satya164/codegen-plugin branch from f6ec3f9 to 1f871ad Compare December 6, 2024 16:50
@satya164 satya164 marked this pull request as ready for review December 6, 2024 16:56
@satya164 satya164 merged commit 2ec645b into main Dec 6, 2024
16 of 19 checks passed
@satya164 satya164 deleted the @satya164/codegen-plugin branch December 6, 2024 16:56
satya164 added a commit that referenced this pull request Dec 6, 2024
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.

Not able to run example app
2 participants