Repository navigation
fix(jobs): load .ts handlers on Node 26 via --import tsx/esm - #105
Merged
Merged
Conversation
Payload's dynamicImport() uses eval('import(...)') to hide handler path
imports from bundler static analysis. On Node ≥ 26, tsx's module.register()
is deprecated and module.registerHooks() is broken when loaded through
Payload's bin.js tsImport() call — so no tsx loader is active when the
eval'd import fires, and Node chokes on the raw .ts files.
Fix: register tsx as a persistent ESM loader upfront via --import tsx/esm
in NODE_OPTIONS (dev, _next, _payload) and in start-worker.mjs's spawn
args. Combined with --disable-transpile on the Payload CLI, this skips
bin.js's own tsx setup (which crashes on Node 26 when tsx is already
loaded) and lets all eval'd dynamic imports resolve .ts files and @/ aliases.
danielheene-website-release Bot
pushed a commit
that referenced
this pull request
Oct 9, 2026
## [1.12.1](v1.12.0...v1.12.1) (2026-10-09) ### Bug Fixes * **jobs:** load .ts handlers on Node 26 via --import tsx/esm ([#105](#105)) ([409b554](409b554))
|
🎉 This PR is included in version 1.12.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
dynamicImport()useseval('import(...)')to load string handler paths at run time. On Node ≥ 26, tsx'smodule.register()is deprecated andmodule.registerHooks()is intentionally nulled out by Payload'sbin.jsworkaround, so no tsx loader is active when the eval'd import fires — Node chokes on the raw.tsfiles and@/path aliases.--import tsx/esm(viaNODE_OPTIONSindev/_next/_payloadscripts, and directly instart-worker.mjsspawn args) to register tsx as a persistent ESM loader before anything runs.--disable-transpileto the Payload CLI to skip its own tsx setup, which crashes on Node 26 when tsx is already loaded.Test plan
bun run dev— jobs triggered via the admin panel run without handler import errorsnode scripts/start-worker.mjs(or worker container) — heartbeat ping and other scheduled jobs executebun run migrate/bun run generate:types— Payload CLI commands still workbun run test— all unit tests pass