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

Yarn v2 / PnP Support #8164

Closed
2 of 6 tasks
rwjblue opened this issue Oct 31, 2018 · 27 comments
Closed
2 of 6 tasks

Yarn v2 / PnP Support #8164

rwjblue opened this issue Oct 31, 2018 · 27 comments
Labels

Comments

@rwjblue
Copy link
Member

rwjblue commented Oct 31, 2018

Yarn 1.12 added support for a new "Plug 'n Play" feature by way of an --pnp option. This issue is meant to track adding support for ember new foo --yarn to support using --pnp without issue.

Further Reading:

Current known issues:

@drummy2
Copy link

drummy2 commented Jun 4, 2019

I need this so bad. Still looks quite far away :(

@musaffa
Copy link

musaffa commented Nov 25, 2019

@rwjblue Hi, it has been a while. Are you still pursuing this feature? What are the main blockers?

@bartocc
Copy link
Contributor

bartocc commented Feb 28, 2020

I am experimenting with the PnP API to make ember-cli compatible with Yarn PnP.

I might open a draft PR at some point to show the progress and get ideas from the community

@sesam
Copy link

sesam commented Apr 23, 2020

How is Yarn PnP compatibility going?

@bartocc
Copy link
Contributor

bartocc commented Apr 23, 2020

@sesam for the time being, I use https://github.com/yarnpkg/berry/tree/master/packages/plugin-node-modules

@ef4, do you believe embroider will change things regarding yarn PNP ?

@gilest
Copy link

gilest commented Apr 30, 2020

Not sure if I should post this here or make another issue but ember install is incompatible too.

Seems like v2 of the yarn CLI uses -i or --interactive rather than --non-interactive.

ember install ember-file-upload

🚧  Installing packages... This might take a couple of minutes.
Command failed: yarn add --dev ember-file-upload --non-interactive

Unknown Syntax Error: Command not found; did you mean one of:

  0. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...
  1. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...

While running add --dev ember-file-upload --non-interactive

@ef4
Copy link
Contributor

ef4 commented Apr 30, 2020

I spent some time trying to test embroider under PNP and it seems to be blocked on issues within ember-cli itself.

For example, ember-cli/lib/broccoli/ember-app.js is trying to load jquery from bower, because it fails to detect the @ember/jquery and ember-source addons. @embroider/compat dutifully tries to follow along and find jquery from bower, which doesn't exist so it blows up.

I also hit stefanpenner/resolve-package-path#24

The process of debugging this stuff is fairly painful. yarn 2 seems... not really quite done yet. Just getting it to execute ember-cli inside the node debugger was an adventure, requiring hacks. And I still have not managed to get yarn linking of the embroider monorepo's packages into a test app working properly.

@chrisvdp
Copy link

@ef4 I have had similar experiences trying to use yarn 2. For what it's worth, PnP was introduced in yarn classic. You might have a better time testing with that https://classic.yarnpkg.com/en/docs/pnp

@bartocc
Copy link
Contributor

bartocc commented Apr 30, 2020

@ef4 I'd like to know what hack you had to use to execute ember-cli inside the node debugger if you have the time to explain. I have tried to use the yarn run --inspect-brk option listed at https://yarnpkg.com/cli/run, but without luck.

@chrisvdp I had missed that PnP was actually introduced under yarn 1. Interesting!

@ef4
Copy link
Contributor

ef4 commented Apr 30, 2020

@bartocc I had to make a shim program that I could launch with node like:

// launch.js
require('ember-cli/bin/ember')

Then something like:

node --inspect-brk --require /Path/To/Your/.pnp.js ./launch.js

@bartocc
Copy link
Contributor

bartocc commented Apr 30, 2020

thx @ef4

@chrisvdp
Copy link

FWIW, yarn 2.1 is out now and seems better.

@drummy2
Copy link

drummy2 commented Sep 3, 2020

Anymore news? npm installs are so bad for all of the reasons listed here https://yarnpkg.com/features/pnp
Allowing PnP with Ember would help massively for the CI jobs.

@rwjblue rwjblue changed the title Yarn PnP Support Yarn v2 / PnP Support Oct 19, 2020
@Alonski
Copy link
Contributor

Alonski commented Mar 5, 2021

@rwjblue @ef4 @NullVoxPopuli Pinging to see if we can push this forward again :)

@Turbo87
Copy link
Member

Turbo87 commented Jun 3, 2021

FWIW it seems that https://pnpm.io is a much easier way to achieve the same goals and aside from ember-cli not supporting it officially yet it works quite well :)

@Alonski
Copy link
Contributor

Alonski commented Jun 3, 2021

@Turbo87 Do you have any tips/guide on moving from Yarn Workspaces to pnpm?

@Turbo87
Copy link
Member

Turbo87 commented Jun 3, 2021

can't say anything about workspaces since I rarely use those, but AFAIK they are supported by pnpm in some way too

@shamrt
Copy link

shamrt commented Oct 4, 2021

Not sure if I should post this here or make another issue but ember install is incompatible too.

Seems like v2 of the yarn CLI uses -i or --interactive rather than --non-interactive.

ember install ember-file-upload

🚧  Installing packages... This might take a couple of minutes.
Command failed: yarn add --dev ember-file-upload --non-interactive

Unknown Syntax Error: Command not found; did you mean one of:

  0. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...
  1. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...

While running add --dev ember-file-upload --non-interactive

For anyone experiencing this bugaboo, I've created a simple Yarn 2 plugin to mitigate the issue: https://github.com/rewardops/plugin-ignore-add-options

@bartocc
Copy link
Contributor

bartocc commented Oct 14, 2021

Not sure if I should post this here or make another issue but ember install is incompatible too.
Seems like v2 of the yarn CLI uses -i or --interactive rather than --non-interactive.

ember install ember-file-upload

🚧  Installing packages... This might take a couple of minutes.
Command failed: yarn add --dev ember-file-upload --non-interactive

Unknown Syntax Error: Command not found; did you mean one of:

  0. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...
  1. yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...

While running add --dev ember-file-upload --non-interactive

For anyone experiencing this bugaboo, I've created a simple Yarn 2 plugin to mitigate the issue: https://github.com/rewardops/plugin-ignore-add-options

Thx for this plugin 👍

@shamrt I'm curious, are you using nodeLinker: node-modules in you ember project?

@shamrt
Copy link

shamrt commented Oct 14, 2021

@shamrt I'm curious, are you using nodeLinker: node-modules in you ember project?

Yep, we are 🙂

@bartocc
Copy link
Contributor

bartocc commented Oct 18, 2021

@shamrt I'm curious, are you using nodeLinker: node-modules in you ember project?

Yep, we are 🙂

Thanks for the feedback 👍

@rwjblue do you know if there are any plans to make ember-cli compatible with yarn's Zero-Installs? I've seen that in ember-cli v4.0.0-beta.1, pnpm support was added via #9563, so I thought maybe some new work on yarn is in the process as well ;-)

@shamrt
Copy link

shamrt commented Oct 19, 2021

@rwjblue do you know if there are any plans to make ember-cli compatible with yarn's Zero-Installs? I've seen that in ember-cli v4.0.0-beta.1, pnpm support was added via #9563, so I thought maybe some new work on yarn is in the process as well ;-)

I should mention that we're using Zero-installs as well!

@LucasHillDex
Copy link

@rwjblue Could you comment on whether ember-cli plans to support PnP? Our team is reviewing options for where to go after yarn v1.

@shamrt If you are using nodeLinker: node-modules you probably aren't fully using zero-installs I'd think? You can commit the .yarn/cache folder to get part way there, but unless you switch to PnP you still have to run a yarn install to explode the cache into the node_modules folder. Unless there's something I'm missing.

@ef4
Copy link
Contributor

ef4 commented Aug 15, 2023

Closing this as stale because it's working in yarn 3.

@ef4 ef4 closed this as completed Aug 15, 2023
@aberres
Copy link

aberres commented Aug 17, 2023

@ef4 Is there a writeup somewhere on what needs to be done to switch an existing app to PnP?

My naive start with setting nodeLinker: pnp led to

$ ember build 
Required packages are missing, run `yarn install` from this directory to install them.

@ef4
Copy link
Contributor

ef4 commented Aug 17, 2023

This issue was created at the time when Yarn 2 forced PnP, so supporting PnP was a blocker for upgrading Yarn. Yarn maintainers eventually realized that wasn't practical and made PnP optional in later 2.x and all of 3.x Yarn. I'm pretty sure the people reporting they're using Yarn 3 are doing it without PnP. I doubt PnP works out of the box.

I don't think anybody would be against seeing PnP blockers fixed, but I also don't expect anybody is working on it because the people who would be working on it (1) have adopted pnpm instead and (2) are putting their time into getting us all off Ember-specific build tooling and onto general-Javascript-ecosystem-supported build-tooling (where the issue of "does it work with Yarn PnP" is not one we have to solve by ourselves).

@aberres
Copy link

aberres commented Aug 18, 2023

@ef4 Thanks for the extensive answer. This clarifies things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests