Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trivial .babelrc breaks <Image> component #61116

Closed
igorkofman opened this issue Jan 25, 2024 · 4 comments · Fixed by #61835
Closed

Trivial .babelrc breaks <Image> component #61116

igorkofman opened this issue Jan 25, 2024 · 4 comments · Fixed by #61835
Labels
linear: next Confirmed issue that is tracked by the Next.js team. locked

Comments

@igorkofman
Copy link

igorkofman commented Jan 25, 2024

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

@igorkofman igorkofman added the bug Issue was opened via the bug report template. label Jan 25, 2024
@igorkofman
Copy link
Author

This works with nextjs 14.0.1 and breaks with 14.1.0

@styfle styfle added kind: bug linear: next Confirmed issue that is tracked by the Next.js team. and removed bug Issue was opened via the bug report template. labels Feb 1, 2024
@raudinm
Copy link

raudinm commented Feb 3, 2024

Same issue with Nextjs 14.1.0

@HQ92
Copy link

HQ92 commented Feb 7, 2024

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

styfle added a commit that referenced this issue Feb 8, 2024
### Why

The `process/browser` lib was imported and being transformed, but
`process.browser = true` turns to `true = true` that causes the
compilation error, we need to exclude them from certain compilation
layers

### What

- Fixes #61116

Closes NEXT-2410
Closes NEXT-2328

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Copy link
Contributor

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 github-actions bot locked as resolved and limited conversation to collaborators Feb 23, 2024
styfle added a commit that referenced this issue Feb 28, 2024
The `process/browser` lib was imported and being transformed, but
`process.browser = true` turns to `true = true` that causes the
compilation error, we need to exclude them from certain compilation
layers

- Fixes #61116

Closes NEXT-2410
Closes NEXT-2328

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linear: next Confirmed issue that is tracked by the Next.js team. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants