{"id":21252,"library":"esbuild-plugin-import-glob","title":"esbuild-plugin-import-glob","description":"A esbuild plugin that enables glob pattern imports, allowing developers to import multiple files using syntax like './migrations/**/*'. Current stable version is 0.1.1. It has no active development cadence (last release likely 2021). Key differentiator: simple integration with esbuild, supports ESM and CJS import styles, returns an array of module exports along with filenames. Lightweight and zero-config.","status":"active","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/thomaschaaf/esbuild-plugin-import-glob","tags":["javascript","esbuild","esbuild-plugin","import","glob","typescript"],"install":[{"cmd":"npm install esbuild-plugin-import-glob","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-import-glob","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-import-glob","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export is a function that creates the plugin instance.","wrong":"const ImportGlobPlugin = require('esbuild-plugin-import-glob');","symbol":"default","correct":"import ImportGlobPlugin from 'esbuild-plugin-import-glob';"},{"note":"When using default import, each module's default export is collected into an array.","wrong":"const migrationsArray = require('./migrations/**/*');","symbol":"glob import (default)","correct":"import migrationsArray from './migrations/**/*';"},{"note":"Namespace import yields an object with 'default' (array of modules) and 'filenames' (array of paths).","wrong":"import migrations from './migrations/**/*';","symbol":"glob import (namespace)","correct":"import * as migrations from './migrations/**/*';"}],"quickstart":{"code":"// esbuild script\nconst esbuild = require('esbuild');\nconst ImportGlobPlugin = require('esbuild-plugin-import-glob');\n\nesbuild.build({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outfile: 'out.js',\n  plugins: [\n    ImportGlobPlugin(),\n  ],\n}).catch(() => process.exit(1));\n\n// usage in source file (e.g., src/index.ts)\n// @ts-ignore\nimport migrationsArray from './migrations/**/*';\n\nconsole.log(migrationsArray); // array of module default exports\n\n// @ts-ignore\nimport * as migrations from './migrations/**/*';\n\nconsole.log(migrations.default); // same as above\nconsole.log(migrations.filenames); // file paths","lang":"typescript","description":"Shows how to set up the plugin in an esbuild build script and use glob imports in source files."},"warnings":[{"fix":"Add // @ts-ignore above each glob import statement.","message":"TypeScript will complain about glob import paths with @ts-ignore.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin to exact version and test updates thoroughly.","message":"Plugin version 0.1.1 is very early; API may break without major version bump.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use a literal string for the glob pattern.","message":"Glob patterns are resolved at build time; dynamic imports with variables are not supported.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Check plugin's peerDependencies and use a compatible esbuild version.","cause":"Plugin may depend on esbuild internals that change between versions.","error":"Error: The plugin 'esbuild-plugin-import-glob' is not compatible with esbuild version X.X.X"},{"fix":"Ensure each matched file has a default export, or use namespace import and access properties directly.","cause":"Accessing default export from import * as X when module has no default export.","error":"TypeError: Cannot read properties of undefined (reading 'default')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}