A tiny esbuild plugin (v0.0.5, updated Dec 2022, no regular release schedule) that enables importing Svelte page components via glob patterns for use with Inertia.js. It removes the need for manual page registration by resolving dynamic imports. Intended for esbuild-based Svelte + Inertia projects. Minimal and focused, but unmaintained since initial release.
npm install esbuild-svelte-inertiaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minimal setup: esbuild config with both svelte and inertia plugins, then import pages via glob for Inertia resolve.
Ensure all Svelte page components have .svelte extension and the pattern matches directory structure exactly.
Use require() in CommonJS context, or configure your project to convert CJS to ESM (e.g., esbuild's --format=esm with CJS shims).
Modify resolve: name => pages['./' + name.replace('./Pages/', '').replace('.svelte', '')] or use a custom resolver.Use 'const svelteInertiaPlugin = require("esbuild-svelte-inertia")' instead of import.Add 'svelteInertiaPlugin()' to the plugins array. Also ensure the directory './Pages' exists relative to the entry point.
Check the exact keys: log 'pages' to see the shape. Common fix: use 'name.replace('/', '').replace('.svelte', '')'.