pluvial / svelte-adapter-deno

A SvelteKit adapter for Deno
https://svelte-adapter-deno.deno.dev/
MIT License
325 stars 13 forks source link

Getting an error with `deno run --allow-env --allow-read --allow-net path/to/build/index.js` #39

Open xanderjakeq opened 1 year ago

xanderjakeq commented 1 year ago
If you want to use a built-in Node module, add a "node:" prefix (ex. "node:assert").
    at file:////sveltekit/server/chunks/firebaseAdmin-918fac7a.js:20:26
      const module = await import('./hooks.server-8f6f964b.js');

I get this error after building with svelte-adapter-deno. Not sure what I did wrong.

jpaquim commented 1 year ago

Hey @xanderjakeq are you trying to import a node module, or is it one of your package dependencies that is importing a node-specific dependency? If so, you may need to patch it to import using the node: specifier for Deno compatibility.

xanderjakeq commented 1 year ago

I don't know.. i think it's my dependencies. This is happening in the build files, so am I editing them directly?

oskarhane commented 1 year ago

I've got a bunch of these on a project I'm trying this out with as well. For assert, fs, buffer etc.
I suppose this adapter only checks the direct dependencies, and not deps of deps?

drewbitt commented 1 year ago

This is pretty much where we are at in #38

jpaquim commented 1 year ago

It does seem to be related, and maybe related to some difference in bundling the built-in node: modules between rollup and esbuild. @drewbitt, @oskarhane, @xanderjakeq could you maybe provide a minimal reproduction just to help with the debugging and to understand if the root cause is the same for your issues?

leo-lox commented 9 months ago

have a simmilar issue

TypeError: Relative import path "dns" not prefixed with / or ./ or ../
If you want to use a built-in Node module, add a "node:" prefix (ex. "node:dns").

code is pretty simple just a +server.ts with

export async function GET(request: RequestEvent) {
    const nameParam = request.url.searchParams.get('name');

    if (!nameParam || nameParam === '_') {
        return defaultResponse();
    }
    // do stuff and send response
    ...
}
deno 1.39.1 (release, x86_64-pc-windows-msvc)
v8 12.0.267.8
typescript 5.3.3
        "svelte": "^4.2.7",
        "svelte-adapter-deno": "^0.9.0",
        "@sveltejs/kit": "^2.0.0",

I tried adding node:dns but same issue

drewbitt commented 9 months ago

@leo-lox according to https://github.com/dbushell/sveltekit-adapter-deno/issues/5#issuecomment-1785922436, this project will likely not receive any updates any time soon and the other adapter is a bit more up to date with fixes.

leo-lox commented 9 months ago

thx, I did not see that