Define Package Exports in package.json
See original GitHub issueIn Node v13, package exports were introduced as an official way to define sub-paths/modules within your package: https://nodejs.org/api/esm.html#esm_package_exports
in the past, Preact has defined sub-package.json’s within the package, to represent each sub-package so that node’s resolution logic would automatically load the right files within them. While that should continue to work (I think) this is the new, “blessed” way forward.
I’m getting ready to enable this for Pika CDN, and would like some packages to test against. If Preact enabled this, we could give your users support for preact/hooks
, preact/debug
, etc. on our CDN.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Modules: Packages | Node.js v19.3.0 Documentation
The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, ...
Read more >Node.JS (New) Package.json Exports Field - Medium
The exports field (or “export map”) provides a way to expose your package modules for different environments and JavaScript flavors WHILE ...
Read more >Exports in package.json - DEV Community
Packages may export functions with the same names but doing different things. Let's look at 2 state managers: Reatom and Effector. Both of...
Read more >package.json - npm Docs
If you plan to publish your package, the most important things in your package.json are the name and version fields as they will...
Read more >New package.json `exports` field not working with TypeScript
The version 13.2 of Node.js allows ESM modules and a new package.json field, called exports , to select and rewrite exported files.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @FredKSchott
I implemented a PR with this, this can be used with
pika.dev
so should be testable already, thanks for all you are doing in the community! Really admire your work!https://github.com/preactjs/preact/pull/2283
Woo! Thanks for taking a second look at this 👍