Git Product home page Git Product logo

Comments (4)

KSXGitHub avatar KSXGitHub commented on May 27, 2024 1

I previously mentioned that in the virtual store, pnpm handles things correctly, but the flat node_modules directory (outside of .pnpm) created by the symlink doesn't resemble the structure seen in yarn or npm's node_modules

I don't think pnpm should goes out of its way to emulate the quirks of other package managers.

with the only distinction being that version 4.3.0 is more up-to-date?

Maybe this distinction is precisely why pnpm prioritize up-to-date version. Can you confirm this, @zkochan?

Regardless, there's no reason pnpm should prioritize the outdated version over the up-to-date one. I'm not sure how yarn and npm prioritize the versions, but (again) there's no reason for pnpm to emulate the others' quirks.

Is this a result of an error in using the shamefully-hoist option?

No. There's no rule that one should be prioritized over the other.

Additionally, as I create a React Native monorepo using pnpm and encounter issues with webpack's inability to interpret the pnpm structure, even with the shamefully-hoist option enabled, I've managed to resolve the situation with Metro and @rnx-kit/metro-resolver-symlinks, but I find myself at an impasse with webpack.

For this, I have 2 suggestions:

  1. Try adding node-linker=hoisted to your .npmrc.
  2. Don't use webpack for new projects. Try Vite.

Furthermore, any guidance on resolving the webpack issue within the context of a React Native monorepo using pnpm would be greatly appreciated.

I'm not familiar with React Native so I don't think I can give any advice.

from pnpm.

zkochan avatar zkochan commented on May 27, 2024 1

It works as expected. As @KSXGitHub said, the symink inside .pnpm is correctly pointing to css-select v2. If you need hoisting identical to the one used by Yarn, you need to use the node-linker=hoisted setting.

from pnpm.

KSXGitHub avatar KSXGitHub commented on May 27, 2024

Upon inspecting the node_modules directory, a noticeable discrepancy is observed. Specifically, the react-native-svg package has a dependency on css-select with version ^2.1.0, yet it is erroneously linked to css-select version 4.3.0. This inconsistency stems from the fact that node-html-parser has a dependency on css-select version 4.3.0.

Clarify what you mean by "inspecting". How did you inspect them?

When I clone your repro repo and do pnpm install --ignore-scripts, I see that node_modules/react-native-svg is a symlink to [email protected][email protected]_@[email protected]_@[email protected]_@babe_owypsel7dhtjfk3xu57dofh4dy and css-select inside the symlink target is the correct version.

Like yarn, it create css-select 4.3.0 in node_modules of node-html-parser, and css-select 2.1.0 flat

Why should pnpm prioritize 2.1.0 over 4.3.0? Both are the same "rank". Why should pnpm prioritize dependencies of react-native-svg over that of node-html-parser? They are equal, the only difference is that 4.3.0 is more up-to-date.


Finally, I have a feeling that this issue of yours could be an XY problem. Let me know what you're trying to solve by shamefully-hoist and I may or may not be able to help you.

from pnpm.

datrhi avatar datrhi commented on May 27, 2024

When I clone your repro repo and do pnpm install --ignore-scripts, I see that node_modules/react-native-svg is a symlink to [email protected][email protected]_@[email protected]_@[email protected]_@babe_owypsel7dhtjfk3xu57dofh4dy and css-select inside the symlink target is the correct version.

I previously mentioned that in the virtual store, pnpm handles things correctly, but the flat node_modules directory (outside of .pnpm) created by the symlink doesn't resemble the structure seen in yarn or npm's node_modules

Why should pnpm prioritize 2.1.0 over 4.3.0? Both are the same "rank". Why should pnpm prioritize dependencies of react-native-svg over that of node-html-parser? They are equal, the only difference is that 4.3.0 is more up-to-date.

Now, let's address the question of pnpm prioritizing version 2.1.0 over 4.3.0. Both versions are of the same "rank," so why does pnpm choose one over the other? Additionally, why does pnpm prioritize dependencies of react-native-svg over those of node-html-parser when both are equal, with the only distinction being that version 4.3.0 is more up-to-date?

The flat node_modules seems to lack the css-select 4.3.0 version, deviating from the structure typically found in yarn or npm-created node_modules. Is this a result of an error in using the shamefully-hoist option?

Additionally, as I create a React Native monorepo using pnpm and encounter issues with webpack's inability to interpret the pnpm structure, even with the shamefully-hoist option enabled, I've managed to resolve the situation with Metro and @rnx-kit/metro-resolver-symlinks, but I find myself at an impasse with webpack.

Is my understanding of the situation accurate, or have I misunderstood the implications of shamefully-hoist? Furthermore, any guidance on resolving the webpack issue within the context of a React Native monorepo using pnpm would be greatly appreciated.

from pnpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.