Registry / web-framework / esbuild-loader-svelte

esbuild-loader-svelte

JSON →
library1.4.0jsnpmunverified

A collection of esbuild plugins for compiling Svelte 5 components (with TypeScript and SCSS support), SCSS styles to CSS, SSR stubbing, raw file imports (?raw suffix), and component meta extraction (?meta suffix). Version 1.4.0. It is actively maintained, ships TypeScript types, and works with esbuild >=0.17.0 and Svelte ^5.0.0. Key differentiators: Svelte 5 Runes support, built-in template engine for SSR, and modular imports.

npm install esbuild-loader-svelte
INSTALL
IMPORT
SIG · ESBUILD-LOADER-SVE
E
esbuild-loader-svelte
web-frameworkjavascriptv1.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sveltePlugin
import { sveltePlugin } from 'esbuild-loader-svelte'
import sveltePlugin from 'esbuild-loader-svelte'
Default export does not exist; must use named import.
scssPlugin
import { scssPlugin } from 'esbuild-loader-svelte/scss'
import { scssPlugin } from 'esbuild-loader-svelte'
Submodule import is available for tree-shaking, but main entry also exports it.
rawPlugin
import { rawPlugin } from 'esbuild-loader-svelte/raw'
const rawPlugin = require('esbuild-loader-svelte/raw')
CommonJS require works but ESM is preferred when using esbuild.
metaPlugin
import { metaPlugin } from 'esbuild-loader-svelte/meta'
import { metaPlugin } from 'esbuild-loader-svelte/meta.js'
Do not add .js extension; Node will resolve correctly.

Shows full setup with all core plugins: Svelte compilation, SCSS, raw imports, and meta extraction.

import { sveltePlugin, scssPlugin, rawPlugin, metaPlugin } from 'esbuild-loader-svelte'; import esbuild from 'esbuild'; await esbuild.build({ entryPoints: ['src/main.ts'], bundle: true, outdir: 'dist', plugins: [ sveltePlugin({ generate: 'client' }), scssPlugin(), rawPlugin(), metaPlugin(), ], });
Debug
Known issues
breakingRequires Svelte ^5.0.0; not compatible with Svelte 4 or earlier.
fix
Upgrade Svelte to version 5 or use an older version of this package (none exist).
affects: >=1.0.0
gotchaESM-only imports from subpaths (e.g., 'esbuild-loader-svelte/svelte') work in Node ESM but may not resolve correctly in CommonJS or bundlers with strict resolver.
fix
Use main entry for CJS: const { sveltePlugin } = require('esbuild-loader-svelte');
affects: >=1.0.0
deprecatedThe 'filterWarnings' option in sveltePlugin defaults to filtering a11y warnings.
fix
If you want to see a11y warnings, pass filterWarnings: () => false.
affects: >=1.0.0
gotchascssPlugin requires the 'sass' package to be installed; if missing, esbuild build will throw 'Cannot find module sass'.
fix
Install sass: npm install sass --save-dev
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'sass'
scssPlugin used without installing sass peer dependency.
fix
npm install sass --save-dev
The requested module 'esbuild-loader-svelte' does not provide an export named 'default'
Using default import when only named exports are available.
fix
import { sveltePlugin } from 'esbuild-loader-svelte'
Error: No matching export in 'esbuild-loader-svelte/raw' for import 'rawPlugin'
Typo in subpath or using wrong casing.
fix
Ensure import path is 'esbuild-loader-svelte/raw' (lowercase, no extension).
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency - required for plugin usage
svelterequiredpeer dependency - compiles Svelte 5 components
sassoptionaloptional - needed for SCSS plugin
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-loader-svelte — npm install esbuild-loader-svelte · libregistry