Description
Describe the bug
Normally when using this it mostly isn't an issue since @sveltejs/kit
does. However, when you create a sveltekit application, @sveltejs/kit
is a devDependency
, while trpc-sveltekit
is a runtime dependency, meaning if you use something like pnpm filter
to prepare a docker container, the cookie
dependency is never recognised and as such is never bundled (unless it ends up being inherited by another package).
Leading to the following error within the docker container:
! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-9.9.0.tgz
> **REDACTED** start /prod
> node ./build/index.js
node:internal/modules/esm/resolve:857
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'cookie' imported from /prod/node_modules/.pnpm/trpc-sveltekit@3.6.2_@sveltejs+adapter-node@5.2.9_@sveltejs+kit@2.9.0_@sveltejs+vite-plugin-s_eoxvcomicsy2pllrdfge5gcesm/node_modules/trpc-sveltekit/dist/server.js
To Reproduce
- Create a PNPM Workspace
- Create a SvelteKit Application as a part of this workspace
- Follow Example 2: Build multiple Docker images in a monorepo to package that application
- Attempt to run the docker container
Expected behavior
It is expected that the cookie module be imported for use in trpc-sveltekit
, however, since it is never declared within this repository it is never added to the virtual store by pnpm filter
when creating minimal containers.
Additional context
I apologise for not being able to link to the repo where this is a problem as it is private code for a product, I'll try to keep an eye on this and provide any other required details where I can.
Though this should be a fairly straight-forward thing the way I see it.
Thanks 😄