FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

minifier inlines a comma-assigned helper arrow which causes (SyntaxError: Identifier 'b' has already been declared) in npm run build · Issue #97517 · vercel/next.js · GitHub

/ next.js Public

minifier inlines a comma-assigned helper arrow which causes (SyntaxError: Identifier 'b' has already been declared) in npm run build #97517

Description

Link to the code that reproduces this issue

https://github.com/ebanek/identifier-e-already-declared-nextjs-minification/

To Reproduce

To Reproduce

In a default npx create-next-app@latest my-app --yes.

repro.js

var join, run;
join = (e, t) => e + t,
  run = (rows) => {
    rows.map((s) => join(s.g, s.r));
    return rows.map((s) => (i) => join(s.g, i.l));
  };
export { run };

app/page.tsx

import * as M from "../repro.js";

export default function Home() {
  return <pre>{Object.keys(M).join(", ")}</pre>;
}

running "npm run build" gives:

 Collecting page data using 5 workers  .Error [ChunkLoadError]: Failed to load chunk server/chunks/ssr/[root-of-the-server]__0f7v31e._.js from runtime for chunk server/app/page.js
    at Object.<anonymous> (.next/server/app/page.js:2:3) {
  [cause]: SyntaxError: Identifier 'b' has already been declared
      at <unknown> (.next/server/chunks/ssr/[root-of-the-server]__0f7v31e._.js:1)
}

> Build error occurred
Error: Failed to collect page data for /
    at ignore-listed frames {
  type: 'Error'
}

This is a minimal example that produces the error I have.
It came from importing superdoc library, which is already minified. Everything works if I set --no-mangling for the next build in package.json.

Current vs. Expected behavior

I expect that the above example displays an empty page. Here I get a syntax error when running npm run build.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:56 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 24.18.0
  npm: 11.16.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.3.1 // Latest available version is detected (16.3.1).
  eslint-config-next: N/A
  react: 19.2.8
  react-dom: 19.2.8
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Webpack, SWC, Turbopack

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

next build (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    SWCRelated to minification/transpilation in Next.js.TurbopackRelated to Turbopack with Next.js.WebpackRelated to Webpack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL