[Bug] 1.2.0 breaks Nextjs/Yarn 3 PnP/Zero Install
See original GitHub issueBug report
Hate to open this! I love swr
and it usually works great. But I just did an upgrade and it broke my build 😢 Repo branch that repros it.
I upgraded from 1.1.2 to 1.2.0 and my NextJS/Yarn 3 project with PnP and zero install active broke. yarn next dev
or yarn next build
errors because it can’t find the swr
module at all as this shows:
I think I narrowed it down to this commit. It changes the exports swr provides and landed between beta 0 and beta 1 of 1.2.0. Consequently, installing version 1.2.0-beta.0 works perfectly, but version 1.2.0-beta.1 breaks it (albeit with a slightly different error, but still one about not being able to resolve swr).
Description / Observed Behavior
Getting this error with swr 1.2.0:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'swr' imported from /Users/dgattey/checkouts/dg/.next/server/pages/index.js
Expected Behavior
For SWR to be able to be resolved into a real package location.
Repro Steps / Code Example
Check out the broken/swr branch of this repo. Happy to give access if useful/explain anything.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Looks like it’s a yarn issue, check this next.js issue comment
I followed the comment here from this yarn issue and then run
yarn install
.Clean the
.next
folder, runyarn dev
, it works.@dgattey I release a patch for fixing this yarn pnp issue, could you try
swr@1.2.1-experimental.0
to see if it works? If it’s good we’ll get it released into stable patch asap