-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite doesn't support Deno's jsr:
imports
#26492
Comments
Here is same project with Bun for comparison: |
I have investigated more, it comes from vite's ESM Module importer in here: const initModule = new AsyncFunction(
ssrModuleExportsKey,
ssrImportMetaKey,
ssrImportKey,
ssrDynamicImportKey,
ssrExportAllKey,
// source map should already be inlined by Vite
'"use strict";' + code,
)
await initModule(
context[ssrModuleExportsKey],
context[ssrImportMetaKey],
context[ssrImportKey],
context[ssrDynamicImportKey],
context[ssrExportAllKey],
) Some reasons it works in bun with special imports but not with deno. |
Ahaa! Found the culprit! Vite has whitelisted what are Deno/Bun imports here: It is missing jsr! NOTICE also very important comment: // Supported by Node, Deno, Bun
const NODE_BUILTIN_NAMESPACE = 'node:'
// Supported by Deno
const NPM_BUILTIN_NAMESPACE = 'npm:'
// Supported by Bun
const BUN_BUILTIN_NAMESPACE = 'bun:'
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
const nodeBuiltins = builtinModules.filter((id) => !id.includes(':'))
// TODO: Use `isBuiltin` from `node:module`, but Deno doesn't support it
export function isBuiltin(id: string): boolean {
if (process.versions.deno && id.startsWith(NPM_BUILTIN_NAMESPACE)) return true
if (process.versions.bun && id.startsWith(BUN_BUILTIN_NAMESPACE)) return true
return isNodeBuiltin(id)
} Deno is missing |
I made a pull request to support It is not fully resolved yet, I get more errors |
jsr:
imports
Why can't you use the deno official vite plugin for that? https://github.com/denoland/deno-vite-plugin |
Never mind, I tried and it did resolve the imports but got a different error, I'll create a repro for that and create and issue with deno/vinxi unsure where the issue is, but jsr resolver is working |
I'm starting to think this is not possible, because With pure deno mode I have test repo: https://github.com/Ciantic/deno-pure-solid-start But it yields even more weirder errors:
|
Deno version: deno --version
deno 2.0.2 (stable, release, x86_64-pc-windows-msvc)
v8 12.9.202.13-rusty
typescript 5.6.2
Here is a repo: https://github.com/Ciantic/deno-pure-solid-start
Discord link
The text was updated successfully, but these errors were encountered: