Skip to content
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

[Feature Request]: Yarn PnP workspace #2236

Open
MarshallChen opened this issue Mar 14, 2023 · 24 comments · May be fixed by #7639
Open

[Feature Request]: Yarn PnP workspace #2236

MarshallChen opened this issue Mar 14, 2023 · 24 comments · May be fixed by #7639
Assignees
Labels
A-resolver Area: resolver awaiting more feedback feat New feature or request
Milestone

Comments

@MarshallChen
Copy link

System Info

System:
OS: macOS 12.6.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 2.54 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.17.4 - /private/var/folders/wv/hb8dy4gs4xq51jx7k9bbtthm0000gn/T/xfs-ce0be687/node
Yarn: 3.4.1 - /private/var/folders/wv/hb8dy4gs4xq51jx7k9bbtthm0000gn/T/xfs-ce0be687/yarn
npm: 6.14.14 - ~/.nvm/versions/node/v14.17.4/bin/npm

Details

is yarn workspace pnp mode supported already or its not support currently. I got lots of errors like this.

error[internal]: Resolve error
   ┌─ src/components/SomeComponent.js:8:1
   │
 8 │ ╭ import React, {
 9 │ │   useCallback,
10 │ │   useMemo,
11 │ │   useState,
12 │ │   useRef,
13 │ │ } from 'react';
   │ ╰───────────────^ Failed to resolve react in /my/local/absolute/path/to/some/other/Component

Reproduce link

No response

Reproduce Steps

NODE_ENV=development yarn rspack serve --config ./rspack.config.js
@MarshallChen MarshallChen added the bug Something isn't working label Mar 14, 2023
@bvanjoi
Copy link
Contributor

bvanjoi commented Mar 14, 2023

This feature is not yet supported

@bvanjoi bvanjoi added the feat New feature or request label Mar 14, 2023
@MarshallChen
Copy link
Author

@bvanjoi Thank you for your prompt response. Could you please let me know if this feature is planned for development and if so, can you provide an estimated timeline for release?

@bvanjoi
Copy link
Contributor

bvanjoi commented Mar 14, 2023

@bvanjoi Thank you for your prompt response. Could you please let me know if this feature is planned for development and if so, can you provide an estimated timeline for release?

We have no plans to support it for now

@MarshallChen
Copy link
Author

Thats bad news, I don't know how big the PnP community is, but since webpack v5 supports yarn PnP by default which means if you guys plan to support this it would be awesome.

@bvanjoi
Copy link
Contributor

bvanjoi commented Mar 14, 2023

Thats bad news, I don't know how big the PnP community is, but since webpack v5 supports yarn PnP by default which means if you guys plan to support this it would be awesome.

Of course, PnP is a really great feature and part of the reason we don't support it at the moment is a lack of manpower, I'll be trying this out over the weekend, and if you're interested, feel free to mention PR, and we can make it happen together!

@MarshallChen
Copy link
Author

Of course, PnP is a really great feature and part of the reason we don't support it at the moment is a lack of manpower, I'll be trying this out over the weekend, and if you're interested, feel free to mention PR, and we can make it happen together!

Lately I did some research and found this pnp-rust implementation of yarn PnP in rust written by yarn maintainer, maybe this repo could give some insights? Looks like this package still in WIP.

@ScriptedAlchemy
Copy link
Contributor

Module Resolution is tricky - but this is a big one I think would be good to ensure we include its ecosystem appropriately

@hyf0 hyf0 removed the bug Something isn't working label Apr 4, 2023
@NyanHelsing
Copy link

NyanHelsing commented Apr 25, 2023

It's still possible to use rspack with yarn 3 by using the node modules plugin/

https://yarnpkg.com/getting-started/migration#if-required-enable-the-node-modules-plugin

@hardfist
Copy link
Contributor

hardfist commented Jan 11, 2024

@Boshen we need to consider support yarn pnp now

@Boshen
Copy link
Contributor

Boshen commented Jan 12, 2024

How many feature requests have we received? It's been almost a year and this is the only feature request I see so far.

How much effort does it go into supporting yarn-pnp?

This feature seems to have a really low benefit–cost ratio.

@hardfist
Copy link
Contributor

I don't know how many users are using yarn pnp, but both yarn、pnpm、webpack、nx support pnp, see https://pnpm.io/blog/2020/10/17/node-modules-configuration-options-with-pnpm#plugnplay-the-strictest-configuration , so don't think it's a outdated feature

@Boshen
Copy link
Contributor

Boshen commented Jan 12, 2024

I'll consider it if we receive more feature requests. oxc-project/oxc-resolver#53

@NyanHelsing
Copy link

Many people might see a feature req. already exists and might consider it duplicative to request it again.

@malyzeli
Copy link

Definitely not a outdated feature, in my opinion Yarn PnP is still a bit underrated mainly because of some compatibility issues during its beginnings. Strictly isolating dependencies (described in link shared by @hardfist above) is very powerful safeguard against weird bugs caused by importing transitive dependencies or using multiple conflicting versions etc., especially in larger codebase. Of course you can check (some of) it with linter, but PnP is preventing that potentially-errorneous import on the lowest level possible. Also having individual dependencies stored as a zip archive instead humongous node_modules with millions of extracted files performs operations a bit faster. Again something which might be improved by pnpm with hardlinks, but you don't always have a global cache to link from - especially when working in a isolated environment. And the icing on the cake is its zero-install strategy because it simplifies the workflow and saves some precious minutes in CI jobs. All in all we would really appreciate if this was supported!

@hardfist
Copy link
Contributor

Definitely not a outdated feature, in my opinion Yarn PnP is still a bit underrated mainly because of some compatibility issues during its beginnings. Strictly isolating dependencies (described in link shared by @hardfist above) is very powerful safeguard against weird bugs caused by importing transitive dependencies or using multiple conflicting versions etc., especially in larger codebase. Of course you can check (some of) it with linter, but PnP is preventing that potentially-errorneous import on the lowest level possible. Also having individual dependencies stored as a zip archive instead humongous node_modules with millions of extracted files performs operations a bit faster. Again something which might be improved by pnpm with hardlinks, but you don't always have a global cache to link from - especially when working in a isolated environment. And the icing on the cake is its zero-install strategy because it simplifies the workflow and saves some precious minutes in CI jobs. All in all we would really appreciate if this was supported!

yeah, i agree it's not a outdated feature, we would love to support it in rspack if people help to contribute to support it

@malyzeli
Copy link

yeah, i agree it's not a outdated feature, we would love to support it in rspack if people help to contribute to support it

@hardfist I would love to help if possible, but I'm not sure if I have the skills required...
This PnP loader must be implemented in Rust I guess?

@hardfist
Copy link
Contributor

hardfist commented Jun 3, 2024

yeah, i agree it's not a outdated feature, we would love to support it in rspack if people help to contribute to support it

@hardfist I would love to help if possible, but I'm not sure if I have the skills required... This PnP loader must be implemented in Rust I guess?

for performance reason, it would be better implemented in rust side

@madjam002
Copy link

There is a Rust implementation of the PnP module resolution algorithm here https://github.com/arcanis/pnp-rust

@hardfist
Copy link
Contributor

hardfist commented Jul 2, 2024

it seems when resolve hook is landed, yarn pnp workspace could be supported by resolve hook, cc @ahabhgk

@ahabhgk ahabhgk self-assigned this Jul 2, 2024
@chenjiahan chenjiahan changed the title [Bug Report]: Yarn PnP workspace [Feature Request]: Yarn PnP workspace Jul 11, 2024
@hardfist
Copy link
Contributor

yarn pnp support is on the roadmap, we will implement it in near future

@malyzeli
Copy link

@hardfist that's great news!

Is this roadmap published somewhere on GitHub?
(I've found only tracking issue for v1.0)

@hardfist hardfist linked a pull request Aug 21, 2024 that will close this issue
2 tasks
@hardfist
Copy link
Contributor

#7639 @malyzeli you can track here

@hardfist hardfist assigned hardfist and unassigned ahabhgk Aug 21, 2024
@chess1
Copy link

chess1 commented Aug 29, 2024

Hi all, any updates on this feature? (@hardfist) :)

@hardfist
Copy link
Contributor

Hi all, any updates on this feature? (@hardfist) :)

still working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolver Area: resolver awaiting more feedback feat New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.