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.
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 adduse strict
during publish.