vercel / next.js

The React Framework
https://nextjs.org
MIT License
123.1k stars 26.3k forks source link

yarn pnp not working on nextjs 14 with babel #58136

Open vip30 opened 8 months ago

vip30 commented 8 months ago

Link to the code that reproduces this issue

https://github.com/vip30/nextjs14-reproduce

To Reproduce

  1. run yarn build
  2. Error: Failed to resolve "@babel/runtime/regenerator" relative to

Current vs. Expected behavior

I tried nextjs 13, it's work

Verify canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103
Binaries:
  Node: 18.18.0
  npm: 9.8.1
  Yarn: 4.0.1
  pnpm: N/A
Relevant Packages:
  next: 14.0.1
  eslint-config-next: 14.0.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

No response

jpedroribeiro commented 6 months ago

@vip30 I had the same issue today and my fix was to explicitly add @babel/runtime as a dependency. This was not needed before Next.js 14.0.4, so it needs some investigating as to why this is now needed.

Edit: It seems this has started on v13.5.7-canary.9, last working version was v13.5.6 - https://github.com/vercel/next.js/compare/v13.5.6...v13.5.7-canary.9

takahiro-1227 commented 4 months ago

I handled this issue by deleting babel.config.js (= compiling SWC). But I still don't know how handle this with babel.

vip30 commented 4 months ago

I have tried @jpedroribeiro solution is working as expected and we need to use some of the babel plugin which swc is not supported so we can't use SWC for compiling