question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define Package Exports in package.json

See original GitHub issue

In 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JoviDeCroockcommented, Jan 27, 2020

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

0reactions
FredKSchottcommented, Feb 6, 2020

Woo! Thanks for taking a second look at this 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found