Conversation
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Pedro Augusto de Paula Barbosa <[email protected]>
README.md Outdated
`-package` lets app authors instantly make and keep fixes to npm | ||
dependencies. It's a vital band-aid for those of us living on the bleeding edge. | ||
Note for module authors: it is not safe to publish an npm package that uses `-package` to a non-dev-dependency. |
laurent22 Oct 23, 2020 •edited
LoadingUh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "why?" part is missing. Either it's obvious why it shouldn't be done, and there's no need to add this to the readme, or it's not, and that should be explained.
My use case is publishing a CLI application and use -package to fix some of the dependencies. It has worked fine for years but lately there's a bug and when I search for some info there's the same "it's not safe" being repeated many times, but it's not explained why or what should be the alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I don't know the why either. I just saw this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is because es are applied to a specific file in your node_modules
folder, but when a package is installed by end users the node_modules dependency tree may shift things around, and this shifting could be due to factors that can't be controlled by -package
.
Also, if the dependency you are ing is also imported by the user of your package, package shouldn't that version of the package... which is not really possible, at least not without some really weird shenanigans.
To work around this issue I used package.json's bundleDependencies
to include the actual dependency I ed in my published package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidmurdoch Nice! By the way, I've used bundleDependencies
in the past for something else in the past, it works well with npm but I've met an issue with yarn...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying @davidmurdoch, perhaps your comment or a shortened version of it could be included in the readme?
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Pedro Augusto de Paula Barbosa <[email protected]>
As mentioned by @papb (#270 (comment)), one way to solve the problem when ing the dependencies of a package that you intend to publish is to use I recommend against making |
How is this still not included in the README? It's a very severe limitation! I certainly wish I had known before using this... for it to not work at all in the end. Pardon me for being this straightforward, but I wasted precious time trying to make this work and searching for answers. Please, for the sake of others who could be in my situation in the future: be explicit about this limitation in your README. Thank you. |
It'd be good to get this merged to document that this isn't intended. As noted in #198 (comment) I managed to make this work as a workaround (when distributing an executable) but it may help folks save some time trying to work out how to do it, if they realise it's not recommended |
Per #84, it is not safe to publish npm packages with ed dependencies. This notice should be prominent in -package documentation.
Note: I don't expect this PR to be merged as it, but rather start a conversation about how to more clearly communicate the use cases for -package.