Skip to content

Conversation

SisyphusZheng
Copy link
Contributor

Problem

Vite SSR in Node.js throws the following error:

[ERR_UNSUPPORTED_ESM_URL_SCHEME] Only file and data URLs are supported by the default ESM loader. Received protocol 'https'

This is caused by attempting to import modules via a remote https:// URL, which is supported by Deno but not by Node.js/Vite.

Solution

Added the JSR package for @fresh/plugin-vite using:

deno add jsr:@fresh/plugin-vite

Updated deno.json imports:

"imports": {
  "@fresh/plugin-vite": "jsr:@fresh/plugin-vite@^0.9.13",
  "@tailwindcss/vite": "npm:@tailwindcss/vite@^4.1.12",
  "vite": "npm:vite@^7.1.4",
  "vite-plugin-inspect": "npm:vite-plugin-inspect@^11.3.2"
}

Result

  • The SSR error is resolved.
  • The project now works correctly with Vite SSR in Node.js environments.

@marvinhagemeister
Copy link
Collaborator

I don't understand how the proposed changes get rid of the mentioned error message.

@SisyphusZheng
Copy link
Contributor Author

I don't understand how the proposed changes get rid of the mentioned error message.

Previously, when I directly forked the project, I couldn't successfully run the dev command in www. An error occurred, and I was required to add a specific file. However, I forgot to take a screenshot of the issue, and now it seems impossible to reproduce it. If I don't encounter this problem again within three days, I will close this

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.

2 participants