{"id":25409,"library":"esbuild-plugin-svelte","title":"esbuild-plugin-svelte","description":"An esbuild plugin to compile Svelte components during bundling. At version 0.1.1, it integrates Svelte 3 with esbuild, handling .svelte files and generating CSS as separate output. It supports preprocessors and compiler options via svelte.config.js. Compared to alternatives like rollup-plugin-svelte, this plugin is lightweight and designed for esbuild's speed. It is best suited for projects already using esbuild and needing Svelte support. Note that it only supports Svelte 3 and esbuild ^0.8. CSS handling defaults to false (esbuild manages CSS) unless overridden.","status":"active","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/yagebu/esbuild-plugin-svelte","tags":["javascript","esbuild","svelte","plugin","typescript"],"install":[{"cmd":"npm install esbuild-plugin-svelte","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-svelte","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-svelte","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to run","package":"esbuild","optional":false},{"reason":"peer dependency for Svelte compilation","package":"svelte","optional":false}],"imports":[{"note":"Default export only; named import will result in undefined.","wrong":"import { svelte } from 'esbuild-plugin-svelte'","symbol":"default","correct":"import svelte from 'esbuild-plugin-svelte'"},{"note":"ESM is preferred; CommonJS require works but is not typical for esbuild.","wrong":"const build = require('esbuild').build","symbol":"esbuild.build","correct":"import { build } from 'esbuild'"},{"note":"If using preprocessors, install svelte-preprocess separately. ESM import is recommended.","wrong":"const preprocess = require('svelte-preprocess')","symbol":"svelte-preprocess","correct":"import preprocess from 'svelte-preprocess'"}],"quickstart":{"code":"import { build } from 'esbuild';\nimport svelte from 'esbuild-plugin-svelte';\n\nbuild({\n  entryPoints: ['src/main.js'],\n  bundle: true,\n  outfile: 'dist/bundle.js',\n  plugins: [svelte()],\n}).catch(() => process.exit(1));","lang":"javascript","description":"Bundles a Svelte app using esbuild with the svelte plugin, outputting a single JS bundle."},"warnings":[{"fix":"Use svelte@^3.20. If using Svelte 4+, switch to a compatible plugin (e.g., @j3w1/esbuild-plugin-svelte).","message":"This plugin only supports Svelte 3; Svelte 4 or 5 will not compile.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Pass { compilerOptions: { css: true } } to svelte() plugin.","message":"CSS output is disabled by default; if you need separate CSS, set compilerOptions.css to true.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Downgrade esbuild to 0.8.x or use a newer fork of the plugin.","message":"Requires esbuild ^0.8; does not work with esbuild 0.9+ due to API changes.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Switch to @j3w1/esbuild-plugin-svelte or @sveltejs/enhanced-img for newer esbuild versions.","message":"This package has not been updated since 2021; consider using maintained forks.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.1.1':16 '0.8':80 '3':20,77 'alreadi':64 'altern':42 'best':60 'bundl':13 'compar':40 'compil':9,36 'compon':11 'css':28,81,88 'default':83 'design':53 'esbuild':2,6,22,55,66,79,86,92 'esbuild-plugin-svelt':1 'fals':85 'file':25 'generat':27 'handl':23,82 'integr':18 'javascript':91 'lightweight':51 'like':43 'manag':87 'need':68 'note':71 'option':37 'output':31 'overridden':90 'plugin':3,7,46,49,94 'preprocessor':34 'project':63 'rollup':45 'rollup-plugin-svelt':44 'separ':30 'speed':57 'suit':61 'support':33,70,75 'svelt':4,10,19,24,47,69,76,93 'svelte.config.js':39 'typescript':95 'unless':89 'use':65 'version':15 'via':38","created_at":"2026-05-01T13:44:37.312830+00:00","updated_at":"2026-05-01T13:44:37.312830+00:00","problems":[{"fix":"npm install --save-dev esbuild-plugin-svelte","cause":"Plugin not installed or missing from package.json.","error":"Cannot find module 'esbuild-plugin-svelte'"},{"fix":"Use import svelte from 'esbuild-plugin-svelte' instead of require().","cause":"Using CommonJS require in an ESM context.","error":"Dynamic require of \"esbuild-plugin-svelte\" is not supported"},{"fix":"Use import svelte from 'esbuild-plugin-svelte' (no braces).","cause":"Incorrect import (named import instead of default).","error":"TypeError: svelte is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/yagebu/esbuild-plugin-svelte","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/esbuild-plugin-svelte","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}