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

feat: use the bob preset for the library during dev #599

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

satya164
Copy link
Member

Previously the React Native Babel preset was being used t compile the library code as well. However, this preset differs from the preset used to publish the library which can introduce inconsistencies.

For example, Metro compiles modules in loose mode which can hide strict mode errors during dev, but they'll surface when consumer uses the library. With this change, we make sure that the same preset is used for dev to avoid the inconsistency.

It also adds a babel plugin to explicitly add use strict - as Metro doesn't use strict mode for ESM code which is not spec-compliant, and the behavior differs from the CommonJS build where we add use strict during publish.

metro compiles modules in loose mode which can hide strict mode errors.
it's also not spec-compliant as ESM should always be in strict mode.
with this change, we explictly add 'use strict' to workaround this.
@satya164 satya164 enabled auto-merge July 26, 2024 12:11
@satya164 satya164 disabled auto-merge July 26, 2024 12:11
@satya164 satya164 enabled auto-merge July 26, 2024 12:11
@satya164 satya164 added this pull request to the merge queue Jul 26, 2024
Merged via the queue into main with commit 3a4e724 Jul 26, 2024
32 checks passed
@satya164 satya164 deleted the @satya164/strict-mode branch July 26, 2024 12:15
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.

2 participants