mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Expose 'react-native/setup-env' to replace InitializeCore (#57461)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57461 Replace `'react-native/Libraries/Core/InitializeCore'` with an explicit `'react-native/setup-env'` secondary export. This was previously a special-case path excluded from our ESLint warnings. It is now formalised. **Changes** - Add new `src/setup-env.js` entry point and `package.json` mapping. - Replace references in `packages/metro-config/` and `packages/community-cli-plugin/`. - Update `warn-on-deep-imports` ESLint rule. Changelog: [General][Added] - Add `'react-native/setup-env'` entry point. This replaces the previous side-effectful `'react-native/Libraries/Core/InitializeCore'`. [General][Deprecated] - Deprecate `'react-native/Libraries/Core/InitializeCore'`. Use `'react-native/setup-env'` instead. Reviewed By: rubennorte Differential Revision: D110890810 fbshipit-source-id: 3afe25efa45548d593a1b09c436e36038350b4c5
This commit is contained in:
1 parent
857c3d24c1
commit
554baba159
15 files changed
+113
-50
No files matched your search
@@ -60,16 +60,17 @@ function getCommunityCliDefaultConfig(
|
||||
return {
|
||||
resolver,
|
||||
serializer: {
|
||||
// We can include multiple copies of InitializeCore here because metro will
|
||||
// We can include multiple copies of setup-env here because Metro will
|
||||
// only add ones that are already part of the bundle
|
||||
getModulesRunBeforeMainModule: () => [
|
||||
require.resolve(
|
||||
path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore'),
|
||||
{paths: [ctx.root]},
|
||||
),
|
||||
// NOTE: ctx.reactNativePath is an absolute path, therefore we need to
|
||||
// reference setup-env.js here by exact path specifier.
|
||||
require.resolve(path.join(ctx.reactNativePath, 'src/setup-env.js'), {
|
||||
paths: [ctx.root],
|
||||
}),
|
||||
...outOfTreePlatforms.map(platform =>
|
||||
require.resolve(
|
||||
`${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`,
|
||||
`${ctx.platforms[platform].npmPackageName}/setup-env`,
|
||||
{paths: [ctx.root]},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user