HTTP imports are no longer a thing when building with vite (?)
Fresh 2.1.1 Deno 2.5.1
- Create a new Fresh app
deno run -Ar jsr:@fresh/init - In
routes/index.tsx, addimport { z } from "https://deno.land/x/[email protected]/mod.ts";above the main function, and thenz.string()within the main function body deno run dev- Visit
localhost:5173 - Observe that the app crashes with
TypeError: [ERR_UNSUPPORTED_ESM_URL_SCHEME] Only file and data URLs are supported by the default ESM loader. Received protocol 'https'
- After
deno task buildanddeno task startthe page does load, but the island does not.
I understand I can probably work around with JSR or by just putting the import in deno.json, but my project is meant to be a Fresh plugin (used to build other final progjects), that also contains some JSX, so I'm not exactly sure what the best way is to deploy it at this point. (It would be really sweet if JSR supported JSX given that was supposed to be "baked in" to Deno).
In any case I think the error message could be a little more clear?
Fresh 1 plugins are not supported in Fresh 2.
Also using esm.sh is discouraged, see here -> https://fresh.deno.dev/docs/advanced/troubleshooting#dont-use-esmsh
@fry69 Zod is not a fresh 1 plugin. This is a bug. Whilst we don't encourage http imports, they're still supported.
@marvinhagemeister I was referring to this part, I should have made this more clear in my response:
but my project is meant to be a Fresh plugin
Sorry, by plugin I mean "package that is meant to be used as a dependency on Fresh sites"