nextjs - 💡(How to fix) Fix Turbopack prod minifier breaks citeproc with Chicago author-date bibliography [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#93353Fetched 2026-04-30 06:17:37
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
issue_type_added ×1labeled ×1subscribed ×1

Error Message

The page renders and the bibliography is produced without error.

  • Disabling experimental.turbopackMinify should not be required to avoid the error.

Code Example

git clone https://github.com/dandyling/citeproc-chicago-author-date-turbopack-build-repro.git
cd citeproc-chicago-author-date-turbopack-build-repro

---

npm install

---

npm dev

---

npm build
npm start

---

experimental: {
   turbopackMinify: false,
}

---

npm build
npm start

---

next: 16.1.7
react: 19.2.3
node: 20.20.0

Additional relevant packages:
- @citation-js/core: 0.7.14
- @citation-js/plugin-csl: 0.7.14
- citeproc: 2.4.63
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/dandyling/citeproc-chicago-author-date-turbopack-build-repro

To Reproduce

  1. Clone the reproduction repo:
git clone https://github.com/dandyling/citeproc-chicago-author-date-turbopack-build-repro.git
cd citeproc-chicago-author-date-turbopack-build-repro
  1. Install dependencies:
npm install
  1. Confirm that dev mode works:
npm dev

Visit http://localhost:3000 The page renders and the bibliography is produced without error.

  1. Build and run in production:
npm build
npm start

Visit http://localhost:3000

  1. Observe that the prod build throws:

    TypeError: Cannot read properties of null (reading '2') at f.Engine.Fun.y [as page_mangler] at f.Engine.processNumber at f.getCite at f.getSortKeys at f.Registry.setsortkeys at f.Engine.updateItems at o.a [as format]

  2. As a control, disable the Turbopack minifier in next.config.ts:

experimental: {
   turbopackMinify: false,
}

Then re-run:

npm build
npm start

Now the page renders correctly in production.

Current vs. Expected behavior

Current behavior

In production with the Turbopack minifier enabled (default for Next.js 16), loading a Chicago author-date CSL style and formatting a bibliography entry that has a page field causes citeproc-js to throw:

TypeError: Cannot read properties of null (reading '2') at f.Engine.Fun.y [as page_mangler] at f.Engine.processNumber at f.getCite at f.getSortKeys at f.Registry.setsortkeys at f.Engine.updateItems at o.a [as format]

This only happens in the prod build; next dev works fine.

The repro is a minimal App Router project whose app/page.tsx is a single client component that, on mount:

  1. Fetches public/chicago-author-date.csl (official CSL XML from citation-style-language/styles).
  2. Registers it via plugins.config.get('@csl').templates.add('chicago-author-date', xml).
  3. Constructs a Cite from one CSL JSON entry that has page: '45-67'.
  4. Calls cite.format('bibliography', { template: 'chicago-author-date', ... }).

With the default Turbopack minifier in production, step 4 crashes with the stack above.

Expected behavior

The production build should behave like next dev:

  • citeproc-js should not throw.
  • The page should render the bibliography HTML for the single entry with the page field, using the Chicago author-date CSL style.
  • Disabling experimental.turbopackMinify should not be required to avoid the error.

Provide environment information

next: 16.1.7
react: 19.2.3
node: 20.20.0

Additional relevant packages:
- @citation-js/core: 0.7.14
- @citation-js/plugin-csl: 0.7.14
- citeproc: 2.4.63

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

Turbopack

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

next build (local), Vercel (Deployed)

Additional context

  • Repro repo: https://github.com/dandyling/citeproc-chicago-author-date-turbopack-build-repro
  • The issue appears to be specific to the Turbopack prod minifier; turning it off via experimental.turbopackMinify: false makes the same code work in production.
  • The CSL style file public/chicago-author-date.csl is the official Chicago author-date style copied verbatim from the citation-style-language/styles repository.
  • The bug only reproduces when the CSL JSON entry includes a page field like page: '45-67', which triggers citeproc-js's page_mangler.
  • Environment: Node 20.20.0, Next.js 16.1.7, React 19.2.3, @citation-js/core 0.7.14, @citation-js/plugin-csl 0.7.14, citeproc 2.4.63.

extent analysis

TL;DR

Disabling the Turbopack minifier by setting experimental.turbopackMinify to false in next.config.ts is a likely workaround to resolve the TypeError issue in production.

Guidance

  • The error is specific to the production build with Turbopack minifier enabled, suggesting a minification issue.
  • Disabling experimental.turbopackMinify resolves the issue, indicating that the problem lies in how the code is minified.
  • The error occurs when processing a CSL JSON entry with a page field, triggering citeproc-js's page_mangler, which may be sensitive to minification.
  • To mitigate, try setting experimental.turbopackMinify to false in next.config.ts to disable minification and see if the issue resolves.

Example

No specific code example is provided as the issue seems related to the build configuration rather than a code snippet.

Notes

The provided reproduction repository and steps to reproduce are helpful for further investigation. The issue might be related to how Turbopack minifies the citeproc-js library, especially the page_mangler function.

Recommendation

Apply the workaround by setting experimental.turbopackMinify to false in next.config.ts, as it has been shown to resolve the issue in the provided reproduction repository. This change allows the production build to work correctly without minification, which seems to be the cause of the TypeError.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The production build should behave like next dev:

  • citeproc-js should not throw.
  • The page should render the bibliography HTML for the single entry with the page field, using the Chicago author-date CSL style.
  • Disabling experimental.turbopackMinify should not be required to avoid the error.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING