vercel / vercel/next.js

Regression in 12.2.0: BrowserslistError during build

Open
#38,898 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug not stale
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Verify canary release
  • I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000
Binaries:
  Node: 16.14.0
  npm: 8.3.1
  Yarn: 1.22.17
  pnpm: N/A
Relevant packages:
  next: 12.2.3
  eslint-config-next: N/A
  react: 17.0.2
  react-dom: 17.0.2
What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

When the .browserslistrc file contains a line current node, the next build fails with this error:

BrowserslistError: Unknown version 16.15.1 of Node.js
Expected Behavior

It used to work in next.js < 12.2.0.

current node can be a nice safety net to compile down js features that are available in all targeted browsers but not in the used node version. Unlikely but possible.

Link to reproduction

https://stackblitz.com/edit/vercel-next-js-ry78bk

To Reproduce

Open the reproduction example and run npm run build in the terminal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction, inspect its .browserslistrc entry, and run npm run build to reproduce the BrowserslistError. Trace how Next.js 12.2.3 processes current node during the build; done means the reproduction builds successfully while retaining support for that Browserslist setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, nodejs
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.