Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function denoLoaderPlugin
import { denoLoaderPlugin } from "https://deno.land/x/esbuild_deno_loader@0.8.2/src/plugin_deno_loader.ts";

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.

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.

Parameters

optional
options: DenoLoaderPluginOptions = [UNSUPPORTED]

Returns

esbuild.Plugin