Using `sequence` means I need to include `@sveltejs/kit` in my Node Docker image
See original GitHub issueDescribe the problem
I noticed when trying to slim down my Docker images that if I kept only the runtime dependencies after building (which I list in dependencies
and install with npm ci --only=prod
) my container would immediately crash because it Cannot find package '@sveltejs/kit' imported from /usr/srv/build/server/app.js
.
It turns out that when you use sequence()
for hooks, the generated app.js
file includes import { sequence } from '@sveltejs/kit/hooks
.
Describe the proposed solution
I’m not sure how, but it would be nice if we copied over the relevant code (the 26 lines from https://github.com/sveltejs/kit/blob/master/packages/kit/src/hooks.js) in the build or something so I don’t have to include the entirety of SvelteKit in my runtime.
Not sure if this is Kit or the adapter.
Alternatives considered
I can just live with it. It’s just ~2MB of the total image size.
Importance
nice to have
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Going to close this in favour of #3176, as the solution to that would cover this issue. I don’t think there’s much mileage in applying a narrower fix here (though now that I think about it,
@sveltejs/kit
is now always marked asnoExternal
when building, so this is probably already fixed)I ran into this issue today. I’ve for now moved my
@sveltejs/kit
to be adependency
to solve the issue for now.