Can I make `mastra` CLI transpile additional entrypoints?
I have the following setup
End goal is to do something like this on my
Dockerfile
Then, be able to run a container with different commands, like
When I run mastra build it bundles everything index.mjs However, runWorkflows.ts is not transpiled,
I tried workaround it by using just tsc & mastra build and try to emit files but that way it duplicates javascript files .mastra and dist
at this point I feel going againts the tide ? any recommendations ?3 Replies
Hi ð
Mastra only compiles code that is somewhere imported into the entrypoint (
src/mastra/index.ts ) or used in one of the tools, agents, etc. There's no option to to compile additional files as one should do this on their own.
You could use just-in-time compilation for your runWorkflow file, e.g. https://tsx.is/getting-started or in later node versions you can run it directy, too: https://nodejs.org/en/learn/typescript/run-nativelyNode.js â Running TypeScript Natively
Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.
ð Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10751
ð If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
ð Thank you for helping us improve Mastra!
Thanks @LekoArts for your answer, I thought that was the case for
mastra CLI, I'll try to make your suggestions work