kit icon indicating copy to clipboard operation
kit copied to clipboard

chore: remove build step for adapter node

Open gtm-nayan opened this issue 1 year ago • 10 comments

todos:

  • [x] check paths work on windows

~~maybe this addresses #10040, not sure~~

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [ ] This message body should clearly illustrate what problems it solves.
  • [ ] Ideally, include a test that fails without this PR but passes with it.

Tests

  • [ ] Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

gtm-nayan avatar May 26 '23 01:05 gtm-nayan

🦋 Changeset detected

Latest commit: 1a6ce3e9e33631f77dd40b5521bed5ae3e07af25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-node Minor

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

changeset-bot[bot] avatar May 26 '23 01:05 changeset-bot[bot]

It doesn't work on windows, what a surprise. But only the sverdle page, whyyyyyyyyyy

Nvm, I'm dum and the server on WSL wasn't killed properly

gtm-nayan avatar May 26 '23 01:05 gtm-nayan

#10040 could be solved by either reading the files directly from outDir/output/server

Are there any downsides to that?

Alternatively copying them to a folder adjacent to outDir/output/server so that the relative paths stay in the correct location.

But both of those require the adpater to know that the files are in outDir/output/server

gtm-nayan avatar May 26 '23 02:05 gtm-nayan

Ah, I see you've removed undici in your latest commit. I was going to ask 'Why does the adapter need that directly? Doesn't it get it via @sveltejs/kit/node/polyfills?'

I think this is an exciting change. When we were running into the memory leak issue in undici, I remember there was confusion arising from how only bumping the version in Kit wasn't enough to get the fix out to people, because adapter-node was bundling it. That's reason enough alone to stop bundling this, I think.

I see that adapter-cloudflare and adapter-netlify also have build steps. I'm not entirely sure that adapter-cloudflare's is doing, but it looks like adapter-netlify's build step is also bundling @sveltejs/kit/node/polyfills, so it would be great to also stop bundling that (in another PR).

Conduitry avatar May 27 '23 14:05 Conduitry

Also updated it to copy files to an adjacent directory, relative paths in sourcemaps should resolve correctly that way. Which should perhaps fix #10040 , @danieldiekmeier can you link to this PR and check?

gtm-nayan avatar May 27 '23 15:05 gtm-nayan

@gtm-nayan I linked the latest commit of this PR locally and I can confirm that it no longer creates the .svelte-kit/adapter-node folder, where the source maps get messed up.

The final source maps in build seem to be correctly pointing directly to the original source files. (This is probably great news for @Lms24, because then Sentry can remove their code that follows the source maps with sorcery.)

danieldiekmeier avatar May 30 '23 22:05 danieldiekmeier

The final source maps in build seem to be correctly pointing directly to the original source files. (This is probably great news for @Lms24, because then Sentry can remove their code that follows the source maps with sorcery.)

Do you have some additional setup for it? For me the sourcemaps in build still point to the generated files in .svelte-kit, I guess we could use rollup-plugin-sourcemaps to merge them, esbuild does it by default in other adapters.

gtm-nayan avatar May 31 '23 01:05 gtm-nayan

Do you have some additional setup for it?

Sorry, you're right: The additional setup is @sentry/sveltekit which merges the source maps. (So I guess it's not great news for @Lms24 after all.) Really sorry for the confusion (I'm confused about this whole setup myself.)

danieldiekmeier avatar May 31 '23 07:05 danieldiekmeier

Thanks for opening this PR @gtm-nayan! While @danieldiekmeier is right that this PR currently won't let us get rid of our flattening workaround with sorcery, #10069 would do that 😄

(We'll probably still need to keep it around to support already released Node adapter versions but we're auto-detecting adapters anyway already so we can just distinguish based on versions).

Furthermore, iiuc this PR would fix the incorrect source file paths within the maps which is a welcome change either way.

Lms24 avatar May 31 '23 07:05 Lms24

When is this getting merged? Undici's memory leak is annoying to me

TomDo1234 avatar Jun 21 '23 09:06 TomDo1234

Any chance this could get fixed and remerged? It got reverted and still having problems with source maps not working.

cpriestland avatar Nov 05 '23 06:11 cpriestland

Any chance this could get fixed and remerged? It got reverted and still having problems with source maps not working.

Adding to the noise here since I haven't seen any movement! Source maps are still wonky for sveltekit with adapter-node + sentry and it's making them very hard to use.

iandoesallthethings avatar Dec 05 '23 16:12 iandoesallthethings