Skip to content

Swc causing error in production. Related to citation-js and citeproc. #69150

Closed
@igloo1505

Description

@igloo1505

Link to the code that reproduces this issue

https://github.com/igloo1505/ulldApp

To Reproduce

I'm building two separate but related projects that are intended to work together. One is a large monorepo, the other is a single Next app currently on 14.2.5. You can clone the single app at the repo here, but it will require an appConfig.ulld.json file at the root of that project that would look something like
appConfig.ulld.json to build and run without blowing up.

Current vs. Expected behavior

The app would produce an error that was related to one of citation-js's dependencies, citeproc which was apparently generated by swc. It ran flawlessly in development, but output this error in production:

TypeError: Cannot read properties of undefined (reading 'name')
    at t.XmlJSON.addMissingNameNodes (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:17:43244)
    at new t.Engine (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:17:67469)
    at u (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:1:373946)
    at c (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:1:374213)
    at bibliography (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:1:374923)
    at tl (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:1:28027)
    at g.tm [as format] (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:1:28107)
    at d (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/chunks/34354.js:17:2746)
    at async v (/Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/.next/server/app/api/events/onSync/route.js:1:12672)
    at async /Users/bigsexy/Desktop/current/ulldSandbox/ulldApp/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36258

Disabling swc with swcMinify: false resolved the issue, but I'm posting here so that you're aware for next@15.x.x when that option won't be available.

There was a related issue submitted by the citation-js author here, but it was close due to inactivity.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.4.1
  npm: 10.8.1
  Yarn: 4.3.1
  pnpm: 9.7.1
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: 14.2.5
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.5.4
Next.js Config:
  output: N/A

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

Runtime, SWC

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

next build (local), next start (local)

Additional context

No response

Metadata

Metadata

Assignees

Labels

RuntimeRelated to Node.js or Edge Runtime with Next.js.SWCRelated to minification/transpilation in Next.js.bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions