-
Notifications
You must be signed in to change notification settings - Fork 919
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
Add support for Yarn v2 (PnP) #194
Comments
Hello! I'd like to work on this. |
Awesome! Would love your help on this. As the OP says, the first thing to do is remove the explicit check that I don't think Rollup will work out of the box with PnP. It looks like we may need to add https://github.com/arcanis/rollup-plugin-pnp-resolve to our plugin chain to solve, in which case we should only do that if we detected PnP mode, vs. always adding this plugin. You should look into how to detect PnP mode (I bet they intentionally made this easy, maybe via |
@FredKSchott Thank You for the directions! I'll get started with this... |
Hey @FredKSchott 👋 I ran through this locally with the following steps:
Stepped through the above and everything seems to work without any changes to the Rollup plugin configuration 👍 EDIT: Just realised this morning that my install script contained |
No way! That's great! So I guess the question then is: how can we detect if a missing node_modules directory is good (user has yarn PnP enabled) vs. bad (user using yarn v1, or npm)? (Alternatively, we could just wait for the v2 work in #236 where node_modules may no longer be required all the time) |
Had a look into this and we can use process.versions.pnp which would allow us to grab the version of the PnP standard in use (if any)! |
Awesome! Sounds like a quick fix to add that check to the conditional mentioned in OP, Glazy want to tackle in a PR? |
Not sure if I am doing something wrong, but Create Snowpack App with react + typescript does not work with yarn pnp in dev mode. Build is ok, but dev fails with:
|
Repro is there: https://github.com/crubier/snowpack-test The same repo but using yarn v1 or yarn v2 with node_modules resolution works fine though. So definitely pnp related |
Ok for the record, the fix is to add this in snowpack.config.js: module.exports = {
mount: {
...
},
plugins: [
...
],
installOptions: {
rollup: {
plugins: [require('rollup-plugin-pnp-resolve')()],
},
},
} |
Thanks for finding this! I'm surprised, according to this table Rollup is supposed to support yarn pnp by default: https://yarnpkg.com/features/pnp#pnp-loose-mode |
The latest versions of snowpack (2.18.0, 3.0.0-rc.1)no longer seem to be compatible with yarn PnP. To reproduce run:
(Adding rollup-plugin-pnp-resolve does not help as well) I traced it down to yarnpkg/berry#899 which is open for quite some time already. |
Which previous version of snowpack still compatible with berry @DreierF ? Thanks EDIT: nvm, Using ~2.17.1 seems to work |
snowpack@2.15.1
However, you might have to add the following to your root package.json:
```
"resolutions": {
"esinstall": "0.3.6"
}
```
…________________________________
Von: Seyi Adebajo <notifications@github.com>
Gesendet: Sunday, December 27, 2020 10:28:56 AM
An: snowpackjs/snowpack <snowpack@noreply.github.com>
Cc: Stephan Troyer <stephantroyer@live.at>; Manual <manual@noreply.github.com>
Betreff: Re: [snowpackjs/snowpack] Add support for Yarn v2 (PnP) (#194)
Which previous version of snowpack still compatible with berry @DreierF<https://github.com/DreierF> ? Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#194 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABL7IWBHW5SBRLBAUT6CJ5LSW345RANCNFSM4KRTP3TA>.
|
Shocked that yarn doesn't support this! We'll roll this change back for now until that Yarn issue is solved. |
With 2.17.1 I ran into issues as soon as I started snowpack. If it's working for you, it should be fine, especially since downgrading is such a quick thing to do. It seems like a fix for yarn will be close (yarnpkg/berry#1584). |
In case you aren't subscribed to the Yarn issue, support just got added via yarnpkg/berry#2291. I successfully tested it by switching to the master branch version (using |
@FredKSchott may I enquire what is the status of this issue?
Then creating a |
Original Discussion: https://www.pika.dev/npm/snowpack/discuss/69
/cc @frbrz, @FredKSchott
We already rely on
require.resolve()
internally, which should mean that Yarn PnP "just works". But, we'll need to confirm. I'd love someones help just trying this out with Yarn PnP. The first step would be to remove these lines from the start:And then seeing what happens / if anything else breaks.
The text was updated successfully, but these errors were encountered: