External package imports throwing error when using mastra dev command
I am importing a local package into other local package where mastra resides. Monorepo setup. Using Logger from that package to be added to mastra flow. While running
mastra dev
, getting the below error
ERROR [2025-10-15 16:23:50.254 +0100] (Mastra CLI): virtual:#virtual-@local/gate (1:9): "Logger" is not exported by "../gate/dist/index.js", imported by "virtual:#virtual-@local/gate"
Now Logger
is being exported from the index.js
file, have checked it but still throwing an error. All mastra packages are on latest version.5 Replies
Hi @Jenil ! Would you happen to have a way to repro this issue? We're trying to tackle all monorepo related issues, so if there's a way for us to repro, that would help. If you can provide a repro, please add it to this mega issue on GH https://github.com/mastra-ai/mastra/issues/6852
GitHub
Monorepos Support mega issue · Issue #6852 · mastra-ai/mastra
Mastra 🤝🏻 Monorepos Hello everyone! 👋🏻 We love to see how many of you want to use Mastra. A lot of you are using Mastra as part of their monorepo setup, often authored in TypeScript. We hear you lo...
Will send the repo steps soon. Just an FYI, it was working fine with @mastra/core - v0.19.x. After upgrading to 0.20.x, we started facing this issue
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/8909
GitHub
[DISCORD:1428042295483301980] External package imports throwing err...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1428042295483301980 I am importing a local package into other local package where mastra resides. Monorepo...
Sorry for the delay in sharing the reproduction steps. I had to first figure out how to reproduce the issue, as I wasn’t sure where the problem originated — our monorepo setup is quite complex.
I’ve identified the cause: the monorepo was configured with CommonJS, which caused local package imports to not resolve correctly when running mastra dev. After converting all packages to use ESM, everything started working as expected.
mastra dev
is now workingThanks for getting back to us 😉