[RN 0.88] Add modern exports field to package.json
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- react-native, typescript
- Domain
- build-system, developer-experience
Research direction
Open package.json and compare the existing legacy "react-native" condition with the proposed exports map. Add the listed package and ./jest/mock entries while preserving the legacy condition, then verify that the types, import, require, and package.json paths match the built files shown in the issue.
Written by the indexing model from the issue text.
Description
Sub-issue of
the strict TS API breaks packages that point their package.json legacy "react-native" cond to TS sources
which tells tsgo/tsc (via tsconfig, moduleResolution: bundler) to resolve imports to type-check .tsx source files
hitting the errors from deep RN internal imports (error log in parent issue)
the easiest fix is modern package.json exports, without touching the source files
{
"exports": {
".": {
"types": "./lib/typescript/src/index.d.ts",
"import": "./lib/module/index.js",
"require": "./lib/commonjs/index.js"
},
"./jest/mock": {
"types": "./lib/typescript/jest/mock.d.ts",
"import": "./src/jest/mock.tsx",
"require": "./src/jest/mock.tsx"
},
"./package.json": "./package.json"
}
}
while preserving the harmless legacy "react-native" condition to keep older bundlers/toolchains working
example patch
diff --git a/package.json b/package.json
index 59b8a5d..79da3e3 100644
--- a/package.json
+++ b/package.json
@@ -147,5 +147,18 @@
"type": "all",
"jsSrcsDir": "./src/specs"
},
- "packageManager": "yarn@1.22.22"
+ "packageManager": "yarn@1.22.22",
+ "exports": {
+ ".": {
+ "types": "./lib/typescript/src/index.d.ts",
+ "import": "./lib/module/index.js",
+ "require": "./lib/commonjs/index.js"
+ },
+ "./jest/mock": {
+ "types": "./lib/typescript/jest/mock.d.ts",
+ "import": "./src/jest/mock.tsx",
+ "require": "./src/jest/mock.tsx"
+ },
+ "./package.json": "./package.json"
+ }
}
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 259
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from appandflow/react-native-safe-area-context
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
appandflow/react-native-safe-area-context#739 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
good first issue help wanted Platform: Android
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
appandflow/react-native-safe-area-context#216 · 5 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
appandflow/react-native-safe-area-context#774 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
appandflow/react-native-safe-area-context#758 · 2 reactions ·
All issues in appandflow/react-native-safe-area-context
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100