Repository navigation
feat(codemode): Ship QuickJS files in Nitro Function output - #2531
Merged
Merged
Conversation
Add @earendil-works/pi-codemode to @sentry/junior and trace it and quickjs-wasi as whole packages from juniorNitro(), so every app that uses juniorNitro() ships quickjs.wasm and the pi-codemode worker. The example Vercel output check now fails when either file is missing. Refs #1987 Co-Authored-By: Thomas Jiang <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
thomasjiangcy
approved these changes
Nov 2, 2026
This branch was successfully deployed
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.
Prep work for Code Mode (#1987). This adds
@earendil-works/[email protected]to@sentry/juniorand makes Nitro builds ship the files it loads at run time. Nothing runs Code Mode yet.At run time, pi-codemode reads
quickjs-wasi/quickjs.wasmthroughcreateRequireand starts./worker.jswithnew URL(..., import.meta.url). If Rolldown inlines the package, neither path resolves and the Function fails withCannot find module 'quickjs-wasi/quickjs.wasm'.juniorNitro()now adds@earendil-works/pi-codemode*andquickjs-wasi*totraceDeps. Nitro then keeps both packages external and copies them whole into each Function. Because this happens injuniorNitro(), every app that uses it gets the change, includingjunior-prod. In the example build it adds about 1.6 MB to each of the 4 Functions.Nitro traces only packages that the server bundle actually imports. With
traceDepsand no import, the build output had neither file. Soapp.tsnow has a bareimport "@earendil-works/pi-codemode"as a placeholder until the Code Mode tool adds the real import. It loads the JS modules at cold start (about 15 ms locally) but does not load the wasm. The example Vercel output check now fails ifquickjs.wasmor the pi-codemodeworker.jsis missing from the primary or queue Function.traceDepsand itspkg*full-trace syntax have the same handling in every Nitro beta in thenitropeer range, from 3.0.260415 to 3.0.260903. I compared the published dist files, but I only ran a build with 3.0.260522-beta.Open question for the Code Mode track: keep the bare import at startup, or replace it with a lazy
import()at the tool's call site. Both work with this tracing. The output check guards the change either way.via @thomasjiangcy.
--
View Session [Sentry]