Monorepo transpile packages does not appear to be working.
I have an npm monorepo that uses a shared DAO package to facilitate data connections to the db. Importing the package into the mastra server 'app' causes the build job to fail to import. The dev server works fine.
Here is the error message:
2 Replies
I do not know very much about rollup, or debugging really, but after hours of peppering console.logs all over the mastra deploy files, I have determined that this line in the buildExternalDependencies function is the one throwing the error.
The virtual dependency array that is reduced here returns the same 'name' property pattern for all of the packages except for the customerDAO.
(The customer dao comes from another directory. ALL of the packages are in the mastra/.build directory but this one)
I have no idea if any of this information is relevant. The only concrete fact I have been able to confirm is that I am too dumb to figure this out.
OK, updates.
I was able to successfully build! I edited the buildExternalDependencies in order to skip adding the '#virtual-' prefix to the property in the inputs array for my customerDao dependency:
This change made everything work. IDK if there is some configuration I did wrong that caused this?
Also, removing the package from the transpilePackages list did not affect anything. My original assumption about transpilePackages being the root of the problem was wrong
It would also appear that simply excluding the package from the virtualDependency array does not properly fix the problem, as that prevents the package from importing properly
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/8706
GitHub
[DISCORD:1425901393260314695] Monorepo transpile packages does not ...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1425901393260314695 I have an npm monorepo that uses a shared DAO package to facilitate data connections t...