{"id":25312,"library":"esbuild-plugin-autoload","title":"esbuild-plugin-autoload","description":"esbuild/Bun plugin that resolves autoload patterns at build time, supporting @gramio/autoload and elysia-autoload. Version 0.3.3 (stable), requires Bun >=1.1 or Node >=22. It scans a directory for files matching a glob pattern and generates import statements so that autoload-capable libraries can find them at runtime. Unlike generic glob plugins, this one specifically patches the import resolution for elysia-autoload and @gramio/autoload, making it useful for Elysia.js and Gramio projects that rely on convention-based file loading.","status":"active","version":"0.3.3","language":"javascript","source_language":"en","source_url":"https://github.com/kravetsone/esbuild-plugin-autoload","tags":["javascript","esbuild-plugin","bun-plugin","autoload","elysia","elysia-plugin","gramio","gramio-plugin","typescript"],"install":[{"cmd":"npm install esbuild-plugin-autoload","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-autoload","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-autoload","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; requires Node >=22 or Bun >=1.1","wrong":"const autoload = require('esbuild-plugin-autoload')","symbol":"autoload","correct":"import { autoload } from 'esbuild-plugin-autoload'"},{"note":"Both named and default imports are supported and equivalent.","wrong":"import { autoload } from 'esbuild-plugin-autoload'","symbol":"autoload as default","correct":"import autoload from 'esbuild-plugin-autoload'"},{"note":"TypeScript type exported for options object.","wrong":null,"symbol":"type AutoloadOptions","correct":"import type { AutoloadOptions } from 'esbuild-plugin-autoload'"}],"quickstart":{"code":"import { autoload } from 'esbuild-plugin-autoload'\nimport esbuild from 'esbuild'\n\nawait esbuild.build({\n  entryPoints: ['src/index.ts'],\n  outdir: 'dist',\n  bundle: true,\n  plugins: [\n    autoload({\n      pattern: '**/*.{ts,tsx,js}',\n      directory: './src/routes',\n      debug: process.env.DEBUG === '1'\n    })\n  ]\n})\n\nconsole.log('Build complete')","lang":"typescript","description":"Minimal esbuild setup with autoload plugin to scan './src/routes' for files and generate import statements at build time."},"warnings":[{"fix":"Upgrade to Bun 1.1+ or Node 22+. Alternatively, use v0.2.x if locked to older runtimes.","message":"Requires Bun >=1.1 or Node >=22 for Glob support; older runtimes will throw.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Bundle with Bun.build first, then compile the output with `bun build --compile out/index.js`.","message":"Bun compile mode does not support runtime autoload without an extra build step; see the Bun issue.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check your autoload library against the supported list. Open an issue to request new ones.","message":"Only supports elysia-autoload and @gramio/autoload; other autoload libraries will not work.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use `import { autoload }` instead of `import autoload`.","message":"Default import and named import are both allowed; no deprecation yet, but prefer named import for consistency.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade Node to >=22 or Bun to >=1.1.","cause":"Runtime version too low; Glob API requires Node >=22 or Bun >=1.1.","error":"Error: The plugin \"esbuild-plugin-autoload\" must be run with at least Node v22 or Bun v1.1"},{"fix":"Use default import: `import autoload from 'esbuild-plugin-autoload'`.","cause":"Default import used incorrectly with named export expectations.","error":"TypeError: autoload is not a function"},{"fix":"Use import syntax: `import { autoload } from 'esbuild-plugin-autoload'`.","cause":"Using CommonJS require() in an ESM project.","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}