Skip to content

chore: avoid double-bundling - #17068

Merged
elliott-with-the-longest-name-on-github merged 31 commits into
version-3from
remove-double-bundle
Sep 9, 2026
Merged

elliott-with-the-longest-name-on-github merged 31 commits into
version-3from
remove-double-bundle

Conversation

@teemingc

@teemingc teemingc commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

stacked on top of #17077

This PR gets rid of the second bundle step in the Node adapter in favour of configuring the Vite build.


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:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from d4d3267:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/d4d3267b77a505cf6dca5b209e615c23b5616b9f

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17068

@changeset-bot

changeset-bot Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d4d3267

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 Patch

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

@teemingc teemingc added the needs-platform-tests This PR needs to run platform tests in order to merge. label Sep 8, 2026
Comment thread packages/adapter-node/index.js Outdated
return {
environments: {
ssr: {
// TODO: replace build-time constants in the adapter's own entrypoints only, so that identifiers in the app or its dependencies aren't accidentally replaced

@teemingc teemingc Sep 8, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to figure out how to apply the defines only to our own entrypoints. probably by adding a transform hook again rather than using defines here?

Comment thread packages/adapter-node/index.js Outdated
// pass means shared modules (e.g. `SvelteKitError` from `@sveltejs/kit`)
// aren't duplicated. See https://github.com/sveltejs/kit/issues/15755
input: {
// TODO: adapter-index.js should be index.js but we need to avoid overridding the sveltekit one

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to resolve this so that we can run node build rather than node build/adapter-index.js

@svelte-docs-bot

Copy link
Copy Markdown

teemingc and others added 2 commits September 9, 2026 01:51
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Rich-Harris
Rich-Harris previously approved these changes Sep 8, 2026
@Rich-Harris

Copy link
Copy Markdown
Member

(oops, approved while platform-tests are still red. still, looks good apart from whatever's causing those)

@teemingc

teemingc commented Sep 9, 2026 •

Copy link
Copy Markdown
Member Author

I have some of those fixes locally so I’ll push those up soon

EDIT: pushed

teemingc and others added 9 commits September 9, 2026 21:16
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teemingc teemingc mentioned this pull request Sep 9, 2026
6 tasks done
@teemingc
teemingc added this pull request to stack #17076 September 9, 2026 14:01
@teemingc
teemingc removed this pull request from stack #17076 September 9, 2026 14:04
@teemingc teemingc mentioned this pull request Sep 9, 2026
3 of 6 tasks
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teemingc
teemingc marked this pull request as ready for review September 9, 2026 14:43
@teemingc
teemingc requested a review from Rich-Harris September 9, 2026 14:43
@teemingc
teemingc dismissed Rich-Harris’s stale review September 9, 2026 14:44

implementation has changed

Comment thread packages/adapter-node/index.js Outdated
Comment thread packages/adapter-node/index.js
@teemingc
teemingc changed the base branch from version-3 to teemingc-adapter-regression-tests-version-3 September 9, 2026 15:12
teemingc and others added 3 commits September 9, 2026 23:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teemingc teemingc mentioned this pull request Sep 9, 2026
5 of 6 tasks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well this is cool

written.map((file) => extname(file)).filter((ext) => ext && !compressed_extensions.has(ext))
);

builder.log.minor('Building server');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we intentionally lose this log?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I didn’t think we needed it now that we have no second bundling step. At least I don’t think we log this for other adapters (maybe because they have “generating serverless function” instead 🤔)

Base automatically changed from teemingc-adapter-regression-tests-version-3 to version-3 September 9, 2026 22:21
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github merged commit 03f7b48 into version-3 Sep 9, 2026
70 of 71 checks passed
@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github deleted the remove-double-bundle branch September 9, 2026 22:22
elliott-with-the-longest-name-on-github pushed a commit that referenced this pull request Sep 10, 2026
stacked on #17068

closes #10040

Adapter builders can copy generated sourcemaps to a different directory,
leaving relative source paths pointing at the wrong path.

This PR rebases relative `sources` and `sourceRoot` values during copies
while preserving absolute paths, URLs, mappings, indexed-map structure,
and unchanged map text when no rewrite is needed.

An alternative is to use the Rolldown `sourcemapPathTransform` hook but
that makes them invalid for vite preview
https://rolldown.rs/reference/OutputOptions.sourcemapPathTransform

---

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

- [x] 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
- [x] This message body should clearly illustrate what problems it
solves.
- [x] 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

- [x] 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:`.

### Edits

- [x] Please ensure that 'Allow edits from maintainers' is checked. PRs
without this option may be closed.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
teemingc pushed a commit that referenced this pull request Sep 14, 2026
…17103)

#17068 injects the values `adapt` learns after the Vite build by
regex-patching stub identifiers in the built chunks and remapping their
sourcemaps.

Now `adapt` writes them to `build/adapter-node.js` and the chunks import
it. No chunk is edited after Vite writes it, and the adapter has no
runtime dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-platform-tests This PR needs to run platform tests in order to merge. pkg:adapter-node

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adapter-node : sharp included in bundle make node adapter chunk names more descriptive

3 participants