question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] 1.2.0 breaks Nextjs/Yarn 3 PnP/Zero Install

See original GitHub issue

Bug 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: image

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
huozhicommented, Feb 5, 2022

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, run yarn dev, it works.

1reaction
huozhicommented, Jan 29, 2022

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - swr - Vercel - Geeks
TypeError undefined is not a function error on mutate ... Got a error while import SWR 1.2.2 ... [Bug] 1.2.0 breaks Nextjs/Yarn 3...
Read more >
swr - bytemeta
Update key cause infinity render with suspense mode · SWR should throw when trying to suspend on the server · [Bug] 1.2.0 breaks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found