Repository navigation
meriyah.mjs missing at runtime in Next.js "standalone" builds since 10.59.0 (server-utils → meriyah not fully traced by nft) #23034
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
10.69.0
Framework Version
Next.js 16.3.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
- Next.js app with
output: "standalone"andwithSentryConfig. - Initialize the server SDK from
instrumentation.ts. next build, then run the standalone server (node .next/standalone/server.js, or deploy the standalone output).- Observe the runtime failure resolving
meriyah/dist/meriyah.mjs; confirmmeriyah.cjsis present in the traced output butmeriyah.mjsis not.
Expected Result
The standalone build includes every file @sentry/server-utils needs at runtime, including meriyah/dist/meriyah.mjs.
Actual Result
Only meriyah/dist/meriyah.cjs is traced into the standalone output; the ESM entry loaded at runtime needs meriyah.mjs → ERR_MODULE_NOT_FOUND.
Additional Context
After bumping @sentry/nextjs/@sentry/node from 10.37.0 to 10.69.0, the standalone server build fails at runtime with a missing-module error for:
.../node_modules/.pnpm/[email protected]/node_modules/meriyah/dist/meriyah.mjs
The standalone output contains meriyah/dist/meriyah.cjs but not meriyah/dist/meriyah.mjs, so the ESM entry that gets loaded at runtime cannot resolve the parser.
Root cause analysis
meriyah entered the dependency graph at @sentry/[email protected] (first version whose @sentry/[email protected] depends on @apm-js-collab/code-transformer@^0.15.0, which depends on meriyah@^6.1.4). As of [email protected]+, meriyah is also a direct dependency of @sentry/server-utils.
@sentry/server-utils is dual-published, and its ESM build imports meriyah:
// @sentry/server-utils/build/esm/orchestrion/bundler/subscribeInjection.js
import { parse } from 'meriyah';[email protected]'s package.json has an unusual exports map:
"main": "dist/meriyah.cjs",
"exports": {
"types": "./dist/types/meriyah.d.ts",
"module-sync": "./dist/meriyah.mjs", // ESM
"require": "./dist/meriyah.cjs", // CJS
"default": "./dist/meriyah.mjs" // ESM fallback
}Note there is no plain import key (the ESM side lives under module-sync + default), and require is ordered before default.
Next.js output file tracing (@vercel/nft) resolves specifiers with a condition set that includes both import and require. Because exports matching is first-match-in-insertion-order and require appears before default, nft resolves meriyah to the require → dist/meriyah.cjs target and copies only that into the standalone bundle. Node's real ESM loader, resolving the same import, does not have the require condition active, so it falls through to module-sync/default → dist/meriyah.mjs, which was never traced/copied.
Result: nft's traced file set and Node's runtime resolution diverge for this one dual package, so meriyah.mjs is absent from output: "standalone".
Workaround
Force-include the missing file via next.config:
outputFileTracingIncludes: {
"/*": ["../node_modules/.pnpm/meriyah@*/node_modules/meriyah/dist/*.mjs"],
},Fixes
- Have
withSentryConfigadd the required@sentry/server-utilsruntime files (notablymeriyah's.mjs) tooutputFileTracingIncludesautomatically, the same way other packages that trip nft are handled. - Fix this upstream, in either
@vercel/nftormeriyah
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsWaiting for: Product Owner
Activity
linear-code commentedon Aug 4, 2026
JS-3277
timfish commentedon Aug 5, 2026
Which version of Node are you using?
Already reported upstream to nft:
module-syncgated on build-time Node >= 22) vercel/nft#603And fixed in
meriyah, but we're unable to update to v7 yet:importremoved from export map meriyah/meriyah#585Not sure if this is viable. The workaround appears pnpm specific!
We've already fixed this for our next major but this was partly only possible by dropping Node v18 support.
Let me see what I can do!
lourd commentedon Aug 5, 2026
Thank you @timfish 🙏 We're on Node v24.12.0
timfish commentedon Aug 5, 2026
Closed by #23055
fix(v10/server-utils): Stop shipping orchestrion bundler plugins as p…