vite-deno-plugin

A Vite plugin that can resolve Deno modules.

  • Run Vite without node_modules directory.
  • URL import just works.
  • Import map support.

Getting Started

Configure a plugin in vite.config.mts(NOT vite.config.ts).

import { defineConfig } from 'npm:vite@4.5.0';
import viteDeno from 'mod.ts';

export default defineConfig({
  plugins: [viteDeno({})],
});
$ deno run -A npm:vite@4.5.0 . --config ./vite.config.mts

For more details, check out React example directory.

Config

importMapFilename

Specify the filename of import map. Default value is deno.json.

viteDeno({
  importMapFilename: "deno.json"
});

Known Issues

  • Currently npm:* specifier is not supported. So you have to load npm modules via https://esm.sh/ instead.

Examples