Skip to main content
Module

x/esbuild_deno_loader/mod.ts>denoLoaderPlugin

Deno module resolution for `esbuild`
Latest
function denoLoaderPlugin
Re-export
import { denoLoaderPlugin } from "https://deno.land/x/esbuild_deno_loader@0.9.0/mod.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.

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.

Parameters

optional
options: DenoLoaderPluginOptions = [UNSUPPORTED]

Returns

esbuild.Plugin