Skip to content

Commit 79f2a68

Browse files
vonovaksatya164
andauthored
docs: document app.plugin.js in package.json exports (#834)
As people start using package.json exports more, it might be worth highlighting the "usual" exports people might want to have, which includes expo config plugin files (app.plugin.js). Feel free to close if you see this being out of scope. Thank you :) Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
1 parent 07ba55f commit 79f2a68

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/pages/esm.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,22 @@ The `./package.json` field is used to point to the library's `package.json` file
6464

6565
Using the `exports` field has a few benefits, such as:
6666

67-
- It [restricts access to the library's internals](https://nodejs.org/api/packages.html#main-entry-point-export) by default. You can explicitly specify which files are accessible with [subpath exports](https://nodejs.org/api/packages.html#subpath-exports).
6867
- It allows you to specify different entry points for different environments with [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) (e.g. `node`, `browser`, `module`, `react-native`, `production`, `development` etc.).
68+
- It [restricts access to the library's internals](https://nodejs.org/api/packages.html#main-entry-point-export) by default. You can explicitly specify which files are accessible with [subpath exports](https://nodejs.org/api/packages.html#subpath-exports).
69+
70+
So make sure to explicitly specify any files that need to be readable by other tools, e.g. `./app.plugin.js` if you provide a [Expo Config plugin](https://docs.expo.dev/config-plugins/plugins-and-mods/#apppluginjs):
71+
72+
```diff
73+
"exports": {
74+
".": {
75+
"source": "./src/index.tsx",
76+
"types": "./lib/typescript/src/index.d.ts",
77+
"default": "./lib/module/index.js"
78+
},
79+
"./package.json": "./package.json",
80+
+ "./app.plugin.js": "./app.plugin.js"
81+
},
82+
```
6983

7084
### A note on `import.meta`
7185

0 commit comments

Comments
 (0)