html-webpack-deploy-plugin icon indicating copy to clipboard operation
html-webpack-deploy-plugin copied to clipboard

slash should be a runtime dependency

Open Sidnioulz opened this issue 4 years ago • 1 comments
trafficstars

Hi,

Currently trying to use this plugin in a yarn 2 project. It incorrectly lists slash (and, possibly, other dependencies) as a devDependency even though it is used in the source code and should therefore be a runtime dependency. This, in yarn 2, results in the following error:

Error: html-webpack-deploy-plugin tried to access slash, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: slash (via "slash")
Required by: html-webpack-deploy-plugin@virtual:[snip]#npm:3.0.0 (via /home/[snip]/.yarn/$$virtual/html-webpack-deploy-plugin-virtual-954ac73edc/0/cache/html-webpack-deploy-plugin-npm-3.0.0-94a8d4aa9b-8e5a71f1b8.zip/node_modules/html-webpack-deploy-plugin/src/)

Which makes it impossible to use html-webpack-deploy-plugin in a Yarn 2 context.

Sidnioulz avatar Jul 26 '21 14:07 Sidnioulz

Thanks for reporting this interesting issue. I haven't tried out yarn 2 yet so I've never seen this kind of problem.

slash is a dependency of html-webpack-tags-plugin which is a dependency of this package (and I also maintain both packages) so with yarn 1 it just worked since it's a transitive dependency...

I also am usually wary of adding re-used dependencies too many times as that runs the risk of having the version get out of sync and then multiple versions get installed. But I agree that leaving out of the dependencies of this plugin is odd/non-ideal. That said, it feels strange to me that since yarn 1 was less than great at handling peer dependencies and dependency chains in general, that they haven't improve the support/detection of such chains in version 2.

Would you care to put up a PR to make it work with yarn 2?

jharris4 avatar Jul 26 '21 14:07 jharris4