fix: use file:// URL when importing server entry in vite preview#2182
Merged
Conversation
The preview middleware imported dist/server/entry-server.js via a raw absolute path, which Node's ESM loader rejects on Windows with ERR_UNSUPPORTED_ESM_URL_SCHEME. Convert the path with pathToFileURL before importing. Fixes #2140 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6dd2b7a 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 |
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
birkskyum
approved these changes
Jul 15, 2026
lxsmnsyc
approved these changes
Jul 16, 2026
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.
Summary
Fixes #2140.
Running
vite previewon Windows crashed withERR_UNSUPPORTED_ESM_URL_SCHEMEbecause the preview middleware dynamically imported the built server entry via a raw absolute path (process.cwd() + "/dist/server/entry-server.js"). On Windows that resolves to aC:\...path, which Node's ESM loader rejects; POSIX paths happen to be accepted, which is why this only broke on Windows.This converts the path to a proper
file://URL withpathToFileURL(and usespath.joinfor cross-platform separators) before importing, as suggested in the issue's patch.Testing
pnpm buildinpackages/startpasses (import validation,tsc, build script).barefixture with a plainsolidStart()config (no nitro, since nitro outputs to.output/and bypasses this middleware), ranvite preview, and confirmed a 200 response with fully server-rendered HTML.🤖 Generated with Claude Code