[Bug]: public_hoist_pattern
behaves different to public_hoist_pattern
in pnpm
#1884
Labels
bug
Something isn't working
What happened?
public_hoist_pattern
behaves different topublic_hoist_pattern
inpnpm
.rules_js behavior
Take examples in
rules_js
repository as an example (I'm at acb0f7e), wherems
is listed in thepublic_hoist_pattern
.What left in the sandbox becomes the following after
bazel test examples/npm_deps:test6 --sandbox_debug
is ran.It's clear that
ms
is hoisted to<runfile>/examples/npm_deps/node_modules
. However, it's not hoisted to<runfile>/node_modules
. (I tried set"[email protected]"
to["examples/npm_deps", ""]
or just[""]
inpublic_hoist_packages
but that doesn't make any difference).pnpm behavior
Running
pnpm install
inrules_js
repository root gives the followingnode_modules
structure:It hoists the
ms
packages under<repo_root>/node_modules/ms
instead of<repo_root>/examples/npm_deps/node_modules
.Config to mimic the pnpm behavior
After a few try&error when writing this issue, I finally managed to get what I want, so in order to mimic
node_modules
hoisting behavior inpnpm
,"[email protected]"
need to be configured as an array that contains[""]
, and use//:node_modules/ms
instead of//examples/npm_deps:node_modules/ms
.And here is what confuse me
The problem I have is the
node_modules
resolution when a plugin comes into play and hence I got the doc.Since it says
:node_modules/hoisted_pkg
instead of//:node_modules/hoisted_pkg
, I believe it will do the hoisting just like whatpnpm
does, and the doc ofpublic_hoisted_packages
implies so as well.https://docs.aspect.build/rulesets/aspect_rules_js/docs/npm_translate_lock#public_hoist_packages
Question
So first of all, I'm not sure what's the expected behavior of
public_hoist_packages
? Should it do whatpnpm
does, to hoist the dependency into the rootnode_modules
, or like what it is now, to hoist the dependency to the specific package?If the later is the case, maybe the doc can be improved to be less confusing?
Version
Development (host) and target OS/architectures: MacOS (pretty irrelevant I think)
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:"0.0.0"
, as I managed to reproduce it inrules_js
's repository. It's latest main at acb0f7eLanguage(s) and/or frameworks involved: Nothing.
How to reproduce
No response
Any other information?
No response
The text was updated successfully, but these errors were encountered: