-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[DOCS] Possibly undesired and undocumented side-effects from #4917 #5001
Comments
Hey @pvanagtmaal , that won't solve your issue, but I had this issue too and I discussed it with one of the npm developers. (mostly commenting because I think this comment npm/npm-packlist#106 (comment) is particularly insightful and could be taken into account for the documentation update) |
Hi @louis-bompart, Thanks for the link, that comment does indeed explain a lot. In our case there were indeed too many files ignored and we fixed it by adding a root .npmignore "unignoring" the js and js.map files. I do however still feel that this is something that should be in major releases. |
We ran into this issue unexpectedly where our lib and lib-commonjs were in our gitignore in a monorepo. Suddently on update, our lib was no longer included in our package. It didn't break lib-commonjs because we defined a We wound up defining I fully agree with @pvanagtmaal that this should be a major breaking change. |
We had the exact same issue as @brandonthomas - on bundles released with NPM >= 8.11.0 the ESM build but not the CJS build was unexpectedly excluded from the bundle. It's a particularly nasty breaking change because, depending which NPM version consumers of our package are using, they might hit build errors, or (worse) they might not notice any change at first but encounter hard-to-spot bugs (e.g. from multiple builds of mutual dependencies) and inflated bundle size in production builds due to their bundler silently choosing the CJS build over the expected but missing ESM build. Our workaround was adding negation lines like At minimum, if NPM includes the directory specified in the package.json |
No, it shouldn’t, because the “module” key is not a standard thing - it’s just something a few bundlers invented. |
@pvanagtmaal Noted that you believe this should have been a breaking change. This behavior is already documented in https://docs.npmjs.com/cli/v8/commands/npm-publish Closing, but feel free to re-open if you have a specific place you'd like us to publish this information. |
Is there an existing issue for this?
This is a CLI Docs Problem, not another kind of Docs Problem.
Description of Problem
Since #4917, workspace .gitignore files are taken into account. However, this means that if you have a typescript workspace, you likely have
*.js
files in your .gitignore and these will suddenly not be in the packlist anymore.We have a monorepo, structured as follows:
Before npm 8.11.0, a
npm pack
for either backend or client would include the*.js and *.js.map
files fromlib
, but since 8.11.0 only*.d.ts
andindex.js
are packed. (I am not entirely sure whyindex.js
is packed, I doubt it is relevant for this issue)Potential Solution
I would have at least expected the change to be
Affected URL
No response
The text was updated successfully, but these errors were encountered: