Closed benmccann closed 3 years ago
can we include both "main" and "browser"? i wonder if webpack/parcel or some other packager is using the "main" entry point
I think we could probably make main
point to the esm
build. Having main
point to the UMD build which is only meant to be used in the browser is what's causing the problem.
Bundlers can definitely take ESM as input, so should have no issue using an ESM main
- though I expect that they're not using main
given the presence of module
@tambien did you have any thoughts about this?
Do you know what the entry point that unpkg uses? There's a lot of people using this link: https://unpkg.com/tone, and i worry that if it all of a sudden pointed to the esm module instead of build/Tone.js, it might mess up some live sites.
Thanks for taking a look. I've updated it so that it will continue to work for unpkg.
From https://unpkg.com:
If you omit the file path (i.e. use a “bare” URL), unpkg will serve the file specified by the unpkg field in package.json, or fall back to main.
Thanks for the merge! I have this same change pending in tambien/Piano
(https://github.com/tambien/Piano/pull/37) if you'd be able to take a look and merge it there as well. Thanks!!
UMD builds should be listed in
browser
.main
is traditionally meant for the server-side entry point (i.e. CJS)https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main https://docs.npmjs.com/cli/v7/configuring-npm/package-json#browser
The library currently won't load in Vite / SvelteKit because of this