Skip to content

Trivial .babelrc breaks <Image> component #61116

@igorkofman

Description

@igorkofman

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

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 component.

NEXT-2328

Metadata

Metadata

Assignees

No one assigned

    Labels

    linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions