Skip to main content


Deno module resolution for `esbuild`
function denoLoaderPlugin
import { denoLoaderPlugin } from "";

The Deno loader plugin for esbuild. This plugin will load fully qualified file, http, https, and data URLs.

Note that this plugin does not do relative->absolute specifier resolution, or import map resolution. You must use the denoResolverPlugin before the denoLoaderPlugin to do that.

This plugin can be backed by two different loaders, the native loader and the portable loader.

Native Loader

The native loader shells out to the Deno executable under the hood to load files. Requires --allow-read and --allow-run. In this mode the download cache is shared with the Deno executable. This mode respects deno.lock, DENO_DIR, DENO_AUTH_TOKENS, and all similar loading configuration. Files are cached on disk in the same Deno cache as the Deno executable, and will not be re-downloaded on subsequent builds.

NPM specifiers can be used in the native loader without requiring a local node_modules directory. NPM packages are resolved, downloaded, cached, and loaded in the same way as the Deno executable does.

JSR specifiers can be used without restrictions in the native loader. To ensure dependencies are de-duplicated correctly, it is recommended to use a lockfile.

Portable Loader

The portable loader does module downloading and caching with only Web APIs. Requires --allow-read and/or --allow-net. This mode does not respect deno.lock, DENO_DIR, DENO_AUTH_TOKENS, or any other loading configuration. It does not cache downloaded files. It will re-download files on every build.

NPM specifiers can be used in the portable loader, but require a local node_modules directory. The node_modules directory must be created prior using Deno's --node-modules-dir flag.

JSR specifiers require a lockfile to be present to resolve.


options: DenoLoaderPluginOptions = [UNSUPPORTED]