question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using `sequence` means I need to include `@sveltejs/kit` in my Node Docker image

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Rich-Harriscommented, Aug 27, 2022

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 as noExternal when building, so this is probably already fixed)

0reactions
silentworkscommented, Jun 4, 2022

I ran into this issue today. I’ve for now moved my @sveltejs/kit to be a dependency to solve the issue for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting up a development environment for SvelteKit with ...
Learn how to setup a SvelteKit development environment with Docker for predictable environments and easily adding more services to your web ...
Read more >
How to Use the Node Docker Official Image
Learn how to use the Node Docker Official Image for web server and networking applications in this step-by-step guide.
Read more >
dolibarr on Docker Hub develop. For example, to see what ...
Build the application as an Image using Dockerfile. ... Node. Please find the Docker image to use here on Docker Hub, The source...
Read more >
Modules • Docs • SvelteKit
This is not guaranteed to correspond to NODE_ENV or MODE . ... Use this function to deserialize the response from a form submission....
Read more >
10 best practices to containerize Node.js web applications ...
If we build the image from node—which effectively means the node:latest tag—then ... The recommended Node.js Docker image to use would be:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found