{"id":25296,"library":"esbuild-loader-svelte","title":"esbuild-loader-svelte","description":"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.","status":"active","version":"1.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/webcodingnpc/esbuild-loader-svelte","tags":["javascript","esbuild","svelte","svelte5","scss","plugin","ssr","typescript"],"install":[{"cmd":"npm install esbuild-loader-svelte","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-loader-svelte","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-loader-svelte","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - required for plugin usage","package":"esbuild","optional":false},{"reason":"peer dependency - compiles Svelte 5 components","package":"svelte","optional":false},{"reason":"optional - needed for SCSS plugin","package":"sass","optional":true}],"imports":[{"note":"Default export does not exist; must use named import.","wrong":"import sveltePlugin from 'esbuild-loader-svelte'","symbol":"sveltePlugin","correct":"import { sveltePlugin } from 'esbuild-loader-svelte'"},{"note":"Submodule import is available for tree-shaking, but main entry also exports it.","wrong":"import { scssPlugin } from 'esbuild-loader-svelte'","symbol":"scssPlugin","correct":"import { scssPlugin } from 'esbuild-loader-svelte/scss'"},{"note":"CommonJS require works but ESM is preferred when using esbuild.","wrong":"const rawPlugin = require('esbuild-loader-svelte/raw')","symbol":"rawPlugin","correct":"import { rawPlugin } from 'esbuild-loader-svelte/raw'"},{"note":"Do not add .js extension; Node will resolve correctly.","wrong":"import { metaPlugin } from 'esbuild-loader-svelte/meta.js'","symbol":"metaPlugin","correct":"import { metaPlugin } from 'esbuild-loader-svelte/meta'"}],"quickstart":{"code":"import { sveltePlugin, scssPlugin, rawPlugin, metaPlugin } from 'esbuild-loader-svelte';\nimport esbuild from 'esbuild';\n\nawait esbuild.build({\n  entryPoints: ['src/main.ts'],\n  bundle: true,\n  outdir: 'dist',\n  plugins: [\n    sveltePlugin({ generate: 'client' }),\n    scssPlugin(),\n    rawPlugin(),\n    metaPlugin(),\n  ],\n});","lang":"typescript","description":"Shows full setup with all core plugins: Svelte compilation, SCSS, raw imports, and meta extraction."},"warnings":[{"fix":"Upgrade Svelte to version 5 or use an older version of this package (none exist).","message":"Requires Svelte ^5.0.0; not compatible with Svelte 4 or earlier.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use main entry for CJS: const { sveltePlugin } = require('esbuild-loader-svelte');","message":"ESM-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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If you want to see a11y warnings, pass filterWarnings: () => false.","message":"The 'filterWarnings' option in sveltePlugin defaults to filtering a11y warnings.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Install sass: npm install sass --save-dev","message":"scssPlugin requires the 'sass' package to be installed; if missing, esbuild build will throw 'Cannot find module sass'.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install sass --save-dev","cause":"scssPlugin used without installing sass peer dependency.","error":"Cannot find module 'sass'"},{"fix":"import { sveltePlugin } from 'esbuild-loader-svelte'","cause":"Using default import when only named exports are available.","error":"The requested module 'esbuild-loader-svelte' does not provide an export named 'default'"},{"fix":"Ensure import path is 'esbuild-loader-svelte/raw' (lowercase, no extension).","cause":"Typo in subpath or using wrong casing.","error":"Error: No matching export in 'esbuild-loader-svelte/raw' for import 'rawPlugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}