-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serverless adapters appear to be relying on @sveltejs/kit
being present in runtime dependencies
#324
Comments
@antony I can't reproduce this with the Netlify adapter I ran |
I'll try again and create a repro if I can. It's possible that it has been fixed? Thanks for having a look! |
Hey @benmccann I just ran it on a new
|
If you use the "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("@sveltejs/kit/dist/renderer");var e=require("./chunks/app.cjs");exports.init=e.init,exports.render=e.render;
//# sourceMappingURL=app.cjs.map |
Ah, I was expecting it to be under It looks like that's added here: kit/packages/kit/src/api/build/index.js Line 250 in dc4ea38
And made kit/packages/kit/src/api/build/index.js Line 376 in dc4ea38
I personally prefer having most of my dependencies be external on the server because then I get the original source code and line numbers without having to futz with sourcemaps which always seem like a bit of a pain to get correctly configured. E.g. to setup Sentry with source-mapped code you need to make sure to ship the updated source maps to Sentry with each deploy. I know a couple of the other folks prefer having their dependencies bundled in order to have a smaller deployable, but I've never thought it to be worth it with developer time being expensive and disk space being cheap. I'm not that familiar with Lambdas, but I believe they handle external dependencies just fine. @samccone's request to get at the Rollup configuration is somewhat related to this as well. If we had a hook then different adapters might be able to do this differently. It seems like this is something that could be user configurable |
Ah nice - thanks for that! To be honest, it's completely core to how Svelte Kit works so I can't see any value in making people install it. The source mapping is nice, but, and I also use Sentry, if even one part of your codebase needs sourcemaps, then you need to have sourcemaps, and it's unlikely there'd be a production app which doesn't bundle/minify/transpile and thus need sourcemaps. With regards to making it user configurable, I'm not sure this would be a great idea, it adds complexity and I don't know who would configure it. There is also the fact that each adapter needs a slightly different approach: begin vercel netlify/static |
It looks like Netlify also installs the dependencies based off the It's pretty common for server-side libraries to be bundled or transpiled, but I rarely see them minified. That means I usually can get away without sourcemaps on the server-side. Of course, they're still needed for the client-side, so you can't really get away from it forever. But it's often enough to let you kick the can down the road or only have to worry about it for the client and not the server. Anyway, I'd be fine bundling here as long as we don't minify. That still makes the code fairly readable without sourcemaps and probably easier to deploy for most users. |
Ok I might have to try each adapter with a dependency and see if that resolves the issue for each platform. How we ensure that users have this dependency listed might be a different issue. |
I started looking at this and think if we wanted to bundle then we'd need to include kit/packages/kit/src/api/build/index.js Line 361 in dc4ea38
Also, I noticed that client dependencies also look to be externalized, which seemed surprising to me: kit/packages/kit/src/api/build/index.js Line 198 in dc4ea38
Hopefully @Rich-Harris can weigh in with some thoughts here |
Hmm. So I tried moving a few
We may have to bundle for compatibility with Snowpack |
We definitely do want to bundle, otherwise your lambdas will have an indirect dependency on things like Snowpack. Putting it in adapters' The alternative is to split the renderer and utilities out into a package separate from kit |
Describe the bug
A difficult one to track down this, but I've noticed that in the:
adapers, but not the
node
adapter, afterbuild
andadapt
the builtapp.js
, there is a require statement for@sveltejs/kit
which, afaik, shouldn't be a runtime dependency.Logs
Build Output
To Reproduce
I have a simple repro project which I can provide access to if required, but you can also just create a new kit project, use the netlify adapter, and inspect the first line of
app.js
afterbuild
andadapt
Expected behavior
I expect this dependency to be bundled, I suppose.
Information about your SvelteKit Installation:
Severity
It won't run once deployed: https://staging.kezia.ws/
The text was updated successfully, but these errors were encountered: