{"id":25456,"library":"esbuild-svelte-paths","title":"esbuild-svelte-paths","description":"ESBuild plugin that resolves shortcuted paths for Svelte components, allowing imports without '.svelte' extension and folder/file name matching. Current stable version is 0.1.4, released in May 2022. It respects path aliases from tsconfig/jsconfig. Differentiators: specifically for esbuild (not webpack/vite), requires capital-letter last path segment to trigger resolution, and supports custom extensions for other frameworks like Malina.","status":"active","version":"0.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/AlexxNB/esbuild-svelte-paths","tags":["javascript","svelte","esbuild","paths","shortcut","resolve"],"install":[{"cmd":"npm install esbuild-svelte-paths","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-svelte-paths","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-svelte-paths","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export, not default.","wrong":"import sveltePaths from 'esbuild-svelte-paths'","symbol":"sveltePaths","correct":"import { sveltePaths } from 'esbuild-svelte-paths'"},{"note":"CommonJS require must destructure the named export.","wrong":"const sveltePaths = require('esbuild-svelte-paths')","symbol":"sveltePaths (require)","correct":"const { sveltePaths } = require('esbuild-svelte-paths')"},{"note":"sveltePaths is a function that must be called to create the plugin instance.","wrong":"import sveltePaths from 'esbuild-svelte-paths'; plugins: [sveltePaths]","symbol":"Plugin (as ESBuild plugin object)","correct":"const { sveltePaths } = require('esbuild-svelte-paths'); plugins: [sveltePaths()]"}],"quickstart":{"code":"const { sveltePaths } = require('esbuild-svelte-paths');\nconst sveltePlugin = require('esbuild-svelte');\n\nrequire('esbuild').build({\n  entryPoints: ['src/main.js'],\n  bundle: true,\n  outfile: 'public/bundle.js',\n  plugins: [\n    sveltePaths(),\n    sveltePlugin()\n  ]\n}).catch(() => process.exit(1));","lang":"javascript","description":"Shows how to install and configure the plugin in an esbuild script, placing it before the Svelte compiler plugin."},"warnings":[{"fix":"Ensure the order: sveltePaths() first, then sveltePlugin().","message":"Plugin must be placed before any Svelte compiler plugin in the plugins array, otherwise resolution may fail.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use capital letter for the component name in the import path, e.g., import Button from './Button'.","message":"Shortcut only applies when the last path segment starts with a capital letter. Lowercase imports are ignored and treated normally.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use explicit full paths if you need IDE navigation support.","message":"IDE features like ctrl+click and autocomplete are lost for shortcuted imports; the import path is virtual and not resolved by the IDE.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Move sveltePaths() before any Svelte compiler plugin in the plugins array.","cause":"Plugin order is not correct: sveltePaths() is not first or missing.","error":"Plugin must be placed before other plugins in esbuild"},{"fix":"Ensure the last segment of the import path starts with a capital letter, e.g., './Component'.","cause":"Import path does not start with capital letter, so shortcut is not applied and esbuild tries to resolve the file without .svelte extension.","error":"Cannot find module './component' (unexpected)"},{"fix":"Install esbuild-svelte-paths and add it to the plugins array before the Svelte plugin.","cause":"Esbuild is used programmatically with bundle option but plugin is not installed or configured.","error":"The plugin does not work with bundled esbuild"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}