
Deno Vite Plugin
https://github.com/denoland/deno-vite-plugin- Category
- Developer Tools
- Rank
- No. 873Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- denoland
- GitHub
- 116 stars
- Latest release
- 2.0.3
- Date
About
Vite plugin to enable Deno resolution inside Vite projects.
What it does
This package lets Vite builds consume dependency forms common in Deno projects. It reads Deno configuration, follows aliases and workspace mappings, resolves package registry and remote URL imports, then loads and transpiles modules through Deno’s loader.
Why it's ranked here
The implementation addresses more than basic alias lookup. It handles workspace-member scopes, separate client and server settings, remote modules during server rendering, JSON loading, and several Vite generations. Its documented parsing shortcuts and configuration-file boundary keep the verdict measured.
What's good
Environment-specific loaders and caches let browser and server builds resolve the same dependency differently. Configuration discovery recognizes workspace roots, while member imports retain their local mappings. Integration tests execute built fixtures covering aliases, package registries, remote modules, JSON, linked members, and root-local files.
Tradeoffs
Deno-specific resolution cannot apply inside the Vite configuration itself because the plugin cannot intercept that bundling stage. Remote import rewriting uses a regular expression, misses template-literal dynamic imports, and can mistake URLs inside comments or strings. Custom version resolution for package specifiers is also marked unsupported.
How to use it well
Use it when a Vite application shares Deno import maps, workspace members, registry dependencies, or remote modules. Configure distinct browser and server loader behavior when their targets differ, and use the post-transpilation hook for focused transformations. It does not solve Deno-style imports within Vite’s own configuration.
Technical notes+
src/index.ts exports the default deno function, discovers the nearest deno.json or deno.jsonc with findDenoConfig, and creates per-environment Workspace loaders and resolution caches. src/resolver.ts implements resolveDeno and resolveViteSpecifier, preserves workspace-member referrers, converts remote or out-of-root modules into branded virtual IDs, and leaves node: modules unresolved. src/prefixPlugin.ts intercepts npm: and HTTP specifiers early. src/resolvePlugin.ts loads through @deno/loader, rewrites static HTTP imports with HTTP_IMPORT_RE, exposes onLoad, and wraps JSON as a default export. tests/plugin.test.ts builds fixtures under Deno and executes their generated JavaScript with Node. scripts/test-vite-versions.sh exercises Vite majors 5 through 8.
Observed
- License
- MIT
- Primary language
- TypeScript
- Packaging
- ES module package published as @deno/vite-plugin, with distribution files only
- Install surface
- Documented installation through npm, pnpm, or Deno using the npm package
- Interface
- Library plugin for Vite, with a default plugin export and a separate resolver export
- Vite compatibility
- Peer dependency supports Vite major versions 5, 6, 7, and 8
- Testing structure
- Vitest integration tests build fixtures with Deno and execute generated JavaScript with Node
Read from README.md, deno.json, package.json, src/index.ts, src/resolver.ts, src/prefixPlugin.ts, src/resolvePlugin.ts, tests/linked/sub.ts, tests/linked/main.ts, tests/plugin.test.ts, tests/linked/util.ts, LICENSE, tsconfig.json, scripts/test-vite-versions.sh, tests/linked/deno.json.
What it can do
Enable Deno module resolution in Vite projects
Vite project configuration → Configured Vite build system with Deno resolution support
Resolve Deno imports during Vite build process
TypeScript/JavaScript files with Deno-style imports → Resolved module dependencies for bundling
Transform Deno-specific import syntax for Vite compatibility
Source code with Deno import statements → Vite-compatible module imports
Integrate Deno TypeScript configuration with Vite
Deno TypeScript project settings → Unified TypeScript configuration for Vite builds
Bridge Deno runtime APIs with Vite development server
Code using Deno-specific APIs → Compatible code execution in Vite dev environment
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.