Repository navigation
fix(build): ensure standalone package.json declares module type for Node 24 worker compatibility - #10836
Merged
diegosouzapw merged 1 commit intoAug 20, 2026
Conversation
…ode 24 worker compatibility - Update colocate-standalone.mjs to ensure standalone distributions include type: module in package.json - Eliminates Node 24 MODULE_TYPELESS_PACKAGE_JSON runtime reparsing overhead and warnings when worker threads are spawned
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 21, 2026
…stays CJS (#10936) Validado no worktree combinado: typecheck:core, changelog-integrity, complexity, cognitive-complexity, file-size, lint e teste focado (colocate-standalone-esm-scope) todos verdes. Fix real, correção de regressão introduzida por #10836 (server.js CommonJS quebrando com type:module reintroduzido). CI vermelho é o base-red já rastreado em #9985. Obrigado!
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ode 24 worker compatibility (diegosouzapw#10836) Obrigado — corrige um warning real de runtime em produção sob Node.js 24: o package.json do standalone gerado pelo Next.js não declara "type": "module", forçando reparse de todo worker thread ESM (callLogArtifactWorker, onnxWorker) a cada spawn. Validação (worktree combinado a partir de origin/release/v3.8.50, 0 conflitos): - typecheck:core limpo, complexity/cognitive-complexity dentro do baseline - Confirmado que colocate-standalone.mjs escreve "type": "module" corretamente; testado sob Node 24.19.0, workers sobem sem warning de reparse
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…stays CJS (diegosouzapw#10936) Validado no worktree combinado: typecheck:core, changelog-integrity, complexity, cognitive-complexity, file-size, lint e teste focado (colocate-standalone-esm-scope) todos verdes. Fix real, correção de regressão introduzida por diegosouzapw#10836 (server.js CommonJS quebrando com type:module reintroduzido). CI vermelho é o base-red já rastreado em diegosouzapw#9985. Obrigado!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
scripts/build/colocate-standalone.mjsto ensure the generated Next.js standalonepackage.jsondeclares"type": "module".Problem & Motivation
When OmniRoute is built with standalone output and run under Node.js 24, colocated worker threads (such as
callLogArtifactWorker.jsoronnxWorker.js) are bundled in ESM format (--format=esm). Because Next.js's default standalone tracer produces apackage.jsonwithout an explicit module type, Node.js 24 emits:This forces a runtime parsing retry for every newly spawned worker thread and emits repetitive warnings in production logs.
Solution
In the standalone post-build co-location step (
colocate-standalone.mjs), check the generatedstandalone/package.jsonand set"type": "module"if absent.Verification
colocate-standalone.mjsexecutes and writes"type": "module"topackage.json.