Skip to content

fix: convert path to file:// URL before ESM import in preview server#2164

Closed
tsushanth wants to merge 2 commits into
solidjs:mainfrom
tsushanth:fix/windows-preview-path-to-file-url
Closed

fix: convert path to file:// URL before ESM import in preview server#2164
tsushanth wants to merge 2 commits into
solidjs:mainfrom
tsushanth:fix/windows-preview-path-to-file-url

Conversation

@tsushanth

Copy link
Copy Markdown

On Windows, Node's ESM loader requires import specifiers to be valid file:// URLs — a bare absolute path like C:\Users\...\dist\server\entry-server.js triggers ERR_UNSUPPORTED_ESM_URL_SCHEME because the c: prefix is not a recognised URL scheme.

The configurePreviewServer middleware constructs the import path by concatenating process.cwd() with the server entry filename. This works on POSIX but crashes on Windows. Wrapping the concatenated path with pathToFileURL(...).href from node:url produces a valid file:// URL on all platforms while remaining a no-op on POSIX (where pathToFileURL still returns a well-formed file:///... string that the ESM loader accepts).

Fixes #2140

@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5d09975

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

This PR includes changesets to release 1 package
Name Type
@solidjs/start 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

@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 5d09975
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a3c702aba24be000870bd1c
😎 Deploy Preview https://deploy-preview-2164--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jun 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/start@2164
npm i https://pkg.pr.new/solidjs/solid-start/@solidjs/vite-plugin-nitro-2@2164

commit: 5d09975

@brenelz brenelz closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]

2 participants