Consuming a package from a place outside of where it was generated results in typing errors. #4349
Replies: 2 comments
-
This sounds like a usage question and not like a bug in SvelteKit itself, so I converted this into a discussion. If this turns out to not be the case, we can always reconsider. Regarding your question: In your repo I don't see a monorepo setup. For me a monorepo is not just a repository with several independent projects, but something that defines how to glue them together, for example through yarn or pnpm workspaces. The problem is that just referencing the package won't suffice, you need to tell the mode resolving mechanism where to find it. The way to do this would be to make the package appear in the node_modules folder of the consumer, or a node_modules folder above that. For that, the package to consume needs to appear in its |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick reply @dummdidumm! In short I expect the output dir of
I agree workspaces would be a cleaner solution. Or anything but the solution presented here :D |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I'm trying to make a ui-kit inside a monorepo, which should output in a shared folder after running
npm run package
It sort of looks like this:
I want the ui-kit project to output inside the shared folder, which is done easily enough using
kit.package
. However: when the projects trying to consume this package, vscode throws a fit.When the projects consume directly from
ui-kit/package
are aren't any problems, and I don't really understand why. I've tried messing about with tsconfig.json,Reproduction
Example repo: https://github.com/RickMeijer/example-package-error
Setup
npm run package
outputs inpackage_internal/package
npm run package
outputs topackage_exported
npm run package
in package_externalReproduction steps:
Open
package_consumer/src/routes/index.svelte
in vscode, and bask in the error.Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions