Replies: 1 comment
|
They ignore nested package.json main/module fields as well? I mean I guess it can't hurt. Just unfortunate the 2 common ways this is done(the recommended, and the legacy) don't work and we would need to add a 3rd way. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Some ESM systems (f.e. the unpkg.com CDN) don't yet understand package.json
exportsfields, but they do look for index.js files.unpkg/unpkg#286
To make solid-js code compatible in more systems, we could add one-line
index.jsfiles to sub-folders that don't have index files.As an example,
import('//unpkg.com/solid-js@1.2.5/web?module')won't work because it looks forunpkg.com/solid-js@1.2.5/web/index.js, and totally ignoreexportsrules in package.json.As we already have exports rules and systems like Node.js and Webpack 5+ will honor those rules, adding an
index.jsfile will not break those systems because they will continue to map themselves to files indist/.I believe adding
index.jsfiles will be backward compatible, and allow solid-js to be compatible in more places.The files will look like this:
Ready to test it out and make a PR.
All reactions