#Astro monorepo not pickup up local packages
8 messages · Page 1 of 1 (latest)
Hi @pallid pendant. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Astro has a special heuristic that relies on Astro packages to be inside your project. If you have your Astro project in a monorepo setup, your dependencies should ideally be in my-project/packages/astro-app/node_modules/* and specified in my-project/packages/astro-app/package.json source (https://github.com/withastro/astro/issues/9525).
If you're using TypeScript, Astro starter projects include a tsconfig.json file in your project. This file is important so that tools like Astro and VS Code know how to understand your project. If you install Astro manually, be sure to create this file yourself. You can also install the Astro TypeScript plugin (https://www.npmjs.com/package/@astrojs/ts-plugin) to support importing .astro files from .ts files source (https://docs.astro.build/en/guides/typescript#setup).
If you're still having issues, it might be related to the TypeScript moduleResolution setting. If you're using Node 14+, you might want to try setting moduleResolution to node16 in your tsconfig.json source (https://github.com/withastro/astro/issues/7017).
If none of these solutions work, you might want to consider adding your dependencies to the vite.ssr.noExternal part of Astro’s config to ensure that these dependencies are properly installed and bundled source (https://docs.astro.build/en/guides/troubleshooting#adding-dependencies-to-astro-in-a-monorepo).
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@pallid pendant kapa.ai is still learning and improving, please let us know how it did by reacting below
I'm setup my package.json to include the following dependency, "@repo/ui": "workspace:*", but .astro files aren't finding the module while .tsx files are
@brazen mulch
I'm setup my package.json to include the following dependency, "@repo/ui": "workspace:*", but .astro files aren't finding the module while .tsx files are
Let me check the knowledge base for you. One moment! :books:
Astro has a special heuristic that relies on Astro packages to be inside your project. If you have your Astro project in a monorepo setup, your dependencies should ideally be in my-project/packages/astro-app/node_modules/* and specified in my-project/packages/astro-app/package.json source (https://github.com/withastro/astro/issues/9525).
If you're using TypeScript, Astro starter projects include a tsconfig.json file in your project. This file is important so that tools like Astro and VS Code know how to understand your project. If you install Astro manually, be sure to create this file yourself. You can also install the Astro TypeScript plugin (https://www.npmjs.com/package/@astrojs/ts-plugin) to support importing .astro files from .ts files source (https://docs.astro.build/en/guides/typescript#setup).
If you're still having issues, it might be related to the TypeScript moduleResolution setting. If you're using Node 14+, you might want to try setting moduleResolution to node16 in your tsconfig.json source (https://github.com/withastro/astro/issues/7017).