Skip to content
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

Vinxi's build command tries to run node.EXE even when using Deno #407

Open
Ciantic opened this issue Oct 27, 2024 · 1 comment
Open

Vinxi's build command tries to run node.EXE even when using Deno #407

Ciantic opened this issue Oct 27, 2024 · 1 comment

Comments

@Ciantic
Copy link

Ciantic commented Oct 27, 2024

I have example repo here:

https://github.com/Ciantic/deno-solid-test/

Some reason when running it through deno it still tries to run node.exe instances.

Notice the telltale warning:

(Use node.EXE --trace-warnings ... to show where the warning was created)

In following call:

$ deno run -A build 

⚙  Building your app...
vinxi v0.4.3
(node:33840) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node.EXE --trace-warnings ...` to show where the warning was created)
ReferenceError: Deno is not defined
    at file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/@[email protected]/node_modules/@jsr/std__fs/ensure_symlink.js:7:19
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async loadFile (file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/[email protected]/node_modules/vinxi/lib/load-app.js:83:25)
    at async loadApp (file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/[email protected]/node_modules/vinxi/lib/load-app.js:137:19)
    at async Object.run (file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/[email protected]/node_modules/vinxi/bin/cli.mjs:229:17)
    at async runCommand (file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/[email protected]/node_modules/citty/dist/index.mjs:316:16)
    at async runCommand (file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/[email protected]/node_modules/citty/dist/index.mjs:307:11)
    at async runMain (file:///C:/Source/JavaScript/solid-start-test/deno-solid-test/node_modules/.deno/[email protected]/node_modules/citty/dist/index.mjs:445:7)

(With Bun vinxi works only with --bun that does ugly hack of symlinking node.exe as bun.exe)

@Ciantic
Copy link
Author

Ciantic commented Oct 28, 2024

Nitro does have deno support with preset deno_server:

https://github.com/unjs/nitro/blob/v2/docs/2.deploy/10.runtimes/deno.md

But Vinxi is not aware of that:

process.env.SERVER_PRESET ??=
args.preset ??
process.env.TARGET ??
process.env.PRESET ??
process.env.SERVER_PRESET ??
process.env.SERVER_TARGET ??
process.env.NITRO_PRESET ??
process.env.NITRO_TARGET ??
"node-server";
switch (process.env.SERVER_PRESET) {
case "node-server":
await import(
pathToFileURL(process.cwd() + "/.output/server/index.mjs").href
);
break;
case "bun":
const { $ } = await import("../runtime/sh.js");
await $`bun run .output/server/index.mjs`;
break;
default:
log(
`Couldn't run an app built with the ${process.env.SERVER_PRESET} preset locally. Deploy the app to a provider that supports it.`,
);
}

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

No branches or pull requests

1 participant