Skip to content

bundlers/esbuild-impl/svelte-wrapper-plugin

Svelte wrapper esbuild plugin.

Function Description
isMissingSveltePackageError Checks whether an error is the one loading esbuild-svelte throws when the svelte package is not installed. esbuild-svelte imports svelte/compiler when it loads, and package managers that do not install peers (Yarn 1) leave svelte out of a project that has no Svelte components.
svelteWrapperPlugin Wraps the esbuild-svelte plugin to ensure that the correct format is used. esbuild-svelte and svelte-preprocess are loaded when the plugin is set up, not when this module is imported. When the svelte package is not installed, a build with no .svelte file succeeds, and a build that reaches one fails with an error that names the missing package.