next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Trivial .babelrc breaks <Image> component

Open igorkofman opened this issue 1 year ago • 1 comments

Link to the code that reproduces this issue

https://github.com/igorkofman/next-babel-repro

To Reproduce

  1. Creact a .babelrc with just the default contents
  2. npm run dev

Current vs. Expected behavior

igor@MacBook-Air-3 my-app % npm run dev

dev next dev

▲ Next.js 14.1.1-canary.10

  • Local: http://localhost:3000

Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled ✓ Ready in 1033ms Using external babel configuration from /Users/igor/src/my-app/.babelrc ⚠ It looks like there is a custom Babel configuration that can be removed. ⨯ ../../node_modules/process/browser.js TypeError: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "BooleanLiteral" Import trace for requested module: ../../node_modules/process/browser.js ./node_modules/next/dist/compiled/picomatch/index.js ./node_modules/next/dist/shared/lib/match-remote-pattern.js ./node_modules/next/dist/shared/lib/image-loader.js ./node_modules/next/dist/client/image-component.js ○ Compiling / ... ⨯ ../../node_modules/process/browser.js TypeError: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "BooleanLiteral" Import trace for requested module: ../../node_modules/process/browser.js ./node_modules/next/dist/compiled/picomatch/index.js ./node_modules/next/dist/shared/lib/match-remote-pattern.js ./node_modules/next/dist/shared/lib/image-loader.js ./node_modules/next/dist/client/image-component.js

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112
Binaries:
  Node: 20.8.0
  npm: 10.2.5
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.1.1-canary.10 // Latest available version is detected (14.1.1-canary.10).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

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

Not sure

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

next dev (local)

Additional context

Adding trivial .babelrc with just nextjs presets breaks the <Image> component.

NEXT-2328

igorkofman avatar Jan 25 '24 00:01 igorkofman

This works with nextjs 14.0.1 and breaks with 14.1.0

igorkofman avatar Jan 25 '24 00:01 igorkofman

Same issue with Nextjs 14.1.0

raudinm avatar Feb 03 '24 16:02 raudinm

I'm getting this issue as well when trying to use 14.1.0, does not happen with 14.0.4.

HQ92 avatar Feb 07 '24 11:02 HQ92

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

github-actions[bot] avatar Feb 23 '24 00:02 github-actions[bot]