Symptom
mastra dev exits before the server starts when a server.apiRoutes handler imports a workspace package whose exports point at TypeScript sources. On Node 24 the line is Cannot find module '/<repo>/packages/lib/src/sum' imported from /<repo>/packages/lib/src/index.ts. On Node 22 it is Unknown file extension ".ts".
Evidence what you'll see
- The same code works with
mastra buildfollowed bynode .mastra/output/index.mjs. Importing the same package only from a tool or agent also works. - It reproduces with a clean
.mastraon mastra1.33.0. The.tsfile Node fails on is the workspace package source pulled in by theserver-configextraction bundle. - This is not issue #25747. That one was stale
.mastra/output/node_modulesandrm -rf .mastracleared it.
Why it happens
mastra dev builds server.apiRoutes in a separate Rollup pass, extractMastraOptionBundler, then loads .mastra/output/server-config.mjs. That pass had no workspace resolution, so @repo/lib stayed external and Node could not load src/index.ts. Pull request 27303 resolves and inlines those TypeScript workspace files in the extraction bundle.
Affected versions
mastra 1.33.0. Node 22.15.0 (no native type stripping) and Node 24.8.0 (native type stripping, ESM still wants explicit extensions). Reproduced with bun in apps/app after rm -rf .mastra.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
mastra devstarts the server for anapiRouteshandler that imports a workspace package exporting./src/index.ts, withoutUnknown file extension ".ts"orCannot find modulefor that package.
If it still fails
- No published release tag contains pull request 27303. Tag
@mastra/core@1.78.0was compared against merge18c213722066and does not contain it. - Stale
.mastra/output/node_modulesis a different failure; see issue #25747.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it