fix: honor the host's noExternal patterns when adding vitefu's SSR externals - #360
Merged
ryansolid merged 1 commit intoSep 11, 2026
Merged
Conversation
…ternals
The ssr environment hook already refuses to re-externalize anything
`noExternal` inlines, but it compared literal names, while Vite treats
string entries as picomatch patterns and RegExp entries as tests
(`createFilter(undefined, noExternal, { resolve: false })`). Since
next.41 the crawl also reaches packages that consume the Solid runtime
and hands their non-Solid dependencies to `ssr.external`, so a host that
inlines by pattern (TanStack Start's `@tanstack/start**`) saw those
packages externalized and `vite dev` failed with
ERR_PACKAGE_IMPORT_NOT_DEFINED for the `#tanstack-*` imports only Vite
can resolve. Filter the externals with the same matcher Vite uses, and
keep a single string/RegExp `noExternal` instead of dropping it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 4fb1af3 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 |
commit: |
brenelz
added a commit
to TanStack/router
that referenced
this pull request
Sep 11, 2026
…0.0-next.43 Moves solid-js/@solidjs/web to ^2.0.0-rc.8, @solidjs/vite-plugin to ^3.0.0-next.43 and the webpack example's @solidjs/babel-plugin to ^2.0.0-rc.8. rc.8 is ESM-only with engines.node >= 22.12. rc.8 ships the upstream fix for the buffered server-function request (a71e42e), so the srvx Request normalization from the rc.7 commit is dropped again. @solidjs/vite-plugin next.43 honors the host's resolve.noExternal patterns when externalizing the dependencies of Solid consumers (solidjs/solid-vite-plugin#360), which is what broke `vite dev` with "Package import specifier '#tanstack-router-entry' is not defined" on next.41/42. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
birkskyum
pushed a commit
to TanStack/router
that referenced
this pull request
Sep 11, 2026
…0.0-next.43 (#8348) * chore(solid): bump to solid-js 2.0.0-rc.7 and @solidjs/vite-plugin 3.0.0-next.42 Moves solid-js/@solidjs/web to ^2.0.0-rc.7, @solidjs/vite-plugin to ^3.0.0-next.42, @rsbuild/plugin-solid to ^2.0.0-rc.0 and the webpack example's @solidjs/babel-plugin to ^2.0.0-rc.7 across the monorepo. @tanstack/solid-start now normalizes Request subclasses (srvx's Node adapter) into native Requests before Solid's server-function handler sees them: rc.7 buffers every POST body via `new Request(request, { body })`, which undici only accepts for its own instances, so every POST answered 400 under srvx. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore(solid): bump to solid-js 2.0.0-rc.8 and @solidjs/vite-plugin 3.0.0-next.43 Moves solid-js/@solidjs/web to ^2.0.0-rc.8, @solidjs/vite-plugin to ^3.0.0-next.43 and the webpack example's @solidjs/babel-plugin to ^2.0.0-rc.8. rc.8 is ESM-only with engines.node >= 22.12. rc.8 ships the upstream fix for the buffered server-function request (a71e42e), so the srvx Request normalization from the rc.7 commit is dropped again. @solidjs/vite-plugin next.43 honors the host's resolve.noExternal patterns when externalizing the dependencies of Solid consumers (solidjs/solid-vite-plugin#360), which is what broke `vite dev` with "Package import specifier '#tanstack-router-entry' is not defined" on next.41/42. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
configEnvironmentfor thessrenvironment appends vitefu'sssr.externaltoresolve.external, filtering out anything the mergednoExternallist inlines — but with a literalnoExternal.includes(dep)check. Vite judgesnoExternaldifferently: string entries are picomatch patterns and RegExp entries are tests (createFilter(undefined, noExternal, { resolve: false })increateIsConfiguredAsExternal), andexternaltakes precedence overnoExternal.Since 3.0.0-next.41 the crawl also classifies packages that consume the Solid runtime as semi-framework, so their non-Solid dependencies now land in
ssr.external. A host that inlines its packages by pattern gets them externalized anyway. Concretely, TanStack Start setsresolve.noExternal: ['@tanstack/start**', '@tanstack/solid-start**'];@tanstack/solid-startdepends on solid-js, so@tanstack/start-server-core,start-client-core,start-plugin-coreandstart-storage-contextwere added toexternal. Those packages import#tanstack-router-entryand friends, which only Vite's plugin pipeline can resolve, so everyvite devSSR request failed:Resolved
environments.ssr.resolve.externalfor a TanStack Start Solid app on next.42:Fix
Filter vitefu's externals with the same matcher Vite uses for
noExternal(createFilter(undefined, noExternal, { resolve: false })), so pattern and RegExp entries are honored. While there, a single string or RegExpnoExternalvalue is normalized into the merged list instead of being dropped.Same app with this patch (TanStack's own workaround plugin removed):
vite devSSR answers 200 again. Context: TanStack/router#8348 (the rc.7 / next.42 bump), which carries a host-side guard until this lands.🤖 Generated with Claude Code