-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[fix] externalize middlewares.js when using adapter-node's entryPoint #2482
Conversation
🦋 Changeset detectedLatest commit: d8f380c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome. thanks! I'm very happy you took a look at this one as esbuild is not my forte.
I do wonder if there might be a better way to set this up. Rather than making the user import '../build/middlewares.js'
, perhaps we could have them do an import from @sveltejs/adapter-node
? And I wonder if that might even allow us to do just a single esbuild compilation instead of the two that adapter-node
is doing now
And we would then tell esbuild to treat that specially when resolving it, and instead point it to |
Hm. I'm having second thoughts somewhat. IIRC part of the reason for the |
I was thinking it could be just a regular import from a regular node module. We might have to refactor slightly to pass in
Folks wanted to be able to create a custom server and this was the solution that came out of it. I don't think anyone would miss the separate build artifact as long as they can still build a custom server |
Oops. This made |
Fixes #2481, hopefully without breaking anything else. This is almost the same as my suggested solution in my comment on that issue - except it also includes an override for the path in the
onResolve
hook to avoid havingimport { assetsMiddleware, prerenderedMiddleware, kitMiddleware } from "../build/middlewares.js";
in the final file.Before submitting the PR, please make sure you do the following
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0