-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package.json should include an explicit "main" entry #1009
Comments
As long as you're making changes, it'd be also good to add: "exports": {
".": "./index.js",
"./package.json": "./package.json"
}, since adding that field is usually a breaking change, so it's good to add it earlier |
Running into this exact issue - one of the build tools I'm using to bundle the output package uses node's I might take a look into submitting a PR that adds an explicit |
Taking a look at the Given Ijharb's comment, I'd assume it best to just include a |
Yes, always include "main" as CJS; there's no advantage to omitting it. |
Hey, any news. I saw the PR is blocked? |
@DogLooksGood, I ran into the same problem and I wrote a couple of scripts to work around the missing main by adding it: https://gist.github.com/ronsims2/78ed52583f84056969577286b881c0bc |
@ronsims2 Yeah, we are using a patch to add a "main" entry |
It seems that wasm-pack 0.13.0 is now writing a |
This was previously discussed in #94: It's good practice to include a
"main": "main-file.js"
entry in package.json, so that the generated npm package is usable without specifying a file name.The current workaround is to use
wasm-pack build --out-name index
, or to manually adjust package.json after the build. However, even with the main file being called "index.js", it would be better to have an explicit"main": "index.js"
entry, according to this comment by @ljharb, who is on the nodejs Modules team.The text was updated successfully, but these errors were encountered: