vercel / vercel/next.js

nextjs15 with .babelrc report $ is not a function

Open
#74,743 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Link to the code that reproduces this issue

https://github.com/wotermelon/nextjs15-babelrc

To Reproduce
  1. create-nextjs-app
  2. use .babelrc
{
  "presets": [
    [
      "next/babel",
      {
        "preset-env": {
          "useBuiltIns": "usage",
          "corejs": 3
        }
      }
    ]
  ],
  "plugins": []
}

3.run dev command and see the console

Current vs. Expected behavior

this console report error like this:

es.global-this.js:8 Uncaught TypeError: $ is not a function
  at (app-pages-browser)/n…736510805707:5971:1)
  at options.factory (webpack.js?v=1736510805707:712:31)
  at webpack_require (webpack.js?v=1736510805707:37:33)
  at fn (webpack.js?v=1736510805707:369:21)
  at (app-pages-browser)/n…736510805707:7159:1)
  at options.factory (webpack.js?v=1736510805707:712:31)
  at webpack_require (webpack.js?v=1736510805707:37:33)
  at fn (webpack.js?v=1736510805707:369:21)
Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: 1.22.22
  pnpm: 8.6.1
Relevant Packages:
  next: 15.1.4 // Latest available version is detected (15.1.4).
  eslint-config-next: 15.1.4
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.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

No response

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 by running the linked reproduction repository with Next.js 15.1.4 and its shown .babelrc configuration, then run the next dev command to confirm the error. Trace how this Babel configuration is processed during development and compare the generated module behavior with the expected startup behavior. Done means the reproduction runs without the "$ is not a function" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.