Skip to content

fix(templates): add node:process import for deno in vite config templates - #960

Merged
FabianLars merged 5 commits into
tauri-apps:devfrom
katayama8000:feat/use-node-process-import-for-deno
Mar 17, 2026
Merged

FabianLars merged 5 commits into
tauri-apps:devfrom
katayama8000:feat/use-node-process-import-for-deno

Conversation

@katayama8000

Copy link
Copy Markdown
Contributor

When using Deno as the runtime, accessing process as a global triggers:

NodeJS process global is discouraged in Deno. Add import process from "node:process"

This adds the explicit import conditionally when Deno is selected as the package manager.

@FabianLars

Copy link
Copy Markdown
Member

i think we can add the import for node users as well though we may want to annotate it something like this

// @ts-expect-error type error without @types/node package
import process from "node:process";

then we can use the ts-expect-error on the const host line and your deno arg

@FabianLars

Copy link
Copy Markdown
Member

p.s. no idea why ci has been failing today in all prs. can take a look later.

@katayama8000

Copy link
Copy Markdown
Contributor Author

@FabianLars
Thanks for the suggestion

I've updated the templates as follows:

  • JS templates (react, preact, solid, vue): Since there's no type checking, {% if deno %} is unnecessary — import process from "node:process" is now always added for v2.
  • TS templates (react-ts, preact-ts, solid-ts, vue-ts, vanilla-ts) and svelte/svelte-ts: Added the conditional — Deno gets a plain import (types are built-in), while Node/Bun gets // @ts-expect-error type error without @types/node package before the import.

@FabianLars

Copy link
Copy Markdown
Member

TS templates (react-ts, preact-ts, solid-ts, vue-ts, vanilla-ts) and svelte/svelte-ts: Added the conditional — Deno gets a plain import (types are built-in), while Node/Bun gets // @ts-expect-error type error without @types/node package before the import.

Does it cause issues if we have the ts error in the deno version? I'd love to get rid of deno specific stuff here to keep it simple.

@katayama8000

katayama8000 commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

TS templates (react-ts, preact-ts, solid-ts, vue-ts, vanilla-ts) and svelte/svelte-ts: Added the conditional — Deno gets a plain import (types are built-in), while Node/Bun gets // @ts-expect-error type error without @types/node package before the import.

Does it cause issues if we have the ts error in the deno version? I'd love to get rid of deno specific stuff here to keep it simple.

We get following warning.
スクリーンショット 2026-03-17 20 58 09

@FabianLars

Copy link
Copy Markdown
Member

No i meant this line

// @ts-expect-error type error without @types/node package

because if it's just ignored and the import is the same for both node and deno i'd just have that line in both cases so we can get rid of the if/else

@katayama8000

Copy link
Copy Markdown
Contributor Author

@FabianLars
Do I get your point?
df1da09

@FabianLars

Copy link
Copy Markdown
Member

yes that's what i meant! Sorry for me being difficult.

FabianLars
FabianLars previously approved these changes Mar 17, 2026
@FabianLars

Copy link
Copy Markdown
Member

ah sorry, can you also add a changefile like in the other pr?

@katayama8000

Copy link
Copy Markdown
Contributor Author

ah sorry, can you also add a changefile like in the other pr?

Added!

@FabianLars

Copy link
Copy Markdown
Member

thanks!

@FabianLars FabianLars changed the title feat(templates): add node:process import for deno in vite config templates fix(templates): add node:process import for deno in vite config templates Mar 17, 2026
@FabianLars
FabianLars merged commit 87c455b into tauri-apps:dev Mar 17, 2026
7 of 27 checks passed
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