{"id":25429,"library":"esbuild-plugin-wildcard-imports","title":"esbuild-plugin-wildcard-imports","description":"esbuild plugin enabling wildcard/glob imports for dynamic imports, import statements, and require calls. Version 0.0.15, limited to platform=node and bundle=true. Uses fast-glob as matching engine. Supports both CJS and ESM output formats but primarily tested on CJS. Ignores node_modules by default and supports custom ignore patterns. A lightweight alternative to TypeScript path mapping or manual file listing.","status":"active","version":"0.0.15","language":"javascript","source_language":"en","source_url":"https://github.com/andreventuravale/esbuild-plugin-wildcard-imports","tags":["javascript","esbuild","glob","import","plugin","wildcard"],"install":[{"cmd":"npm install esbuild-plugin-wildcard-imports","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-wildcard-imports","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-wildcard-imports","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin is designed for esbuild and uses its plugin API.","package":"esbuild","optional":true},{"reason":"Runtime dependency for glob pattern matching.","package":"fast-glob","optional":false}],"imports":[{"note":"The package is ESM-only. Use dynamic import if using CommonJS.","wrong":"const wildcardImports = require('esbuild-plugin-wildcard-imports')","symbol":"wildcardImports","correct":"import wildcardImports from 'esbuild-plugin-wildcard-imports'"},{"note":"Type-only import for TypeScript users. Options object with ignore property.","wrong":null,"symbol":"WildcardImportsOptions","correct":"import type { WildcardImportsOptions } from 'esbuild-plugin-wildcard-imports'"},{"note":"Default export is a function. Do not use namespace import.","wrong":"import * as wildcardImports from 'esbuild-plugin-wildcard-imports'","symbol":"default export","correct":"import wildcardImports from 'esbuild-plugin-wildcard-imports'"}],"quickstart":{"code":"import * as esbuild from 'esbuild';\nimport wildcardImports from 'esbuild-plugin-wildcard-imports';\n\n// Build with wildcard imports support\nawait esbuild.build({\n  entryPoints: ['src/index.js'],\n  bundle: true,\n  platform: 'node',\n  format: 'cjs',\n  outfile: 'dist/index.js',\n  plugins: [wildcardImports({\n    ignore: ['**/node_modules/**']\n  })]\n});\n\n// Example usage in source:\n// import { endpoints } from './endpoints/**/*.js';","lang":"javascript","description":"Configures esbuild with wildcard imports plugin, bundling for Node.js with CJS output. The plugin resolves glob patterns in import paths."},"warnings":[{"fix":"Ensure esbuild options include platform: 'node' and bundle: true.","message":"Only works with platform=node and bundle=true. Other configurations may cause build failures.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use format=esm or avoid top-level await in dynamically imported modules.","message":"Dynamic imports with top-level await will not work with format=cjs.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Do not attempt to include node_modules in glob patterns; they are excluded by design.","message":"node_modules are always ignored regardless of ignore patterns.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"If you need other path types, the plugin will not resolve glob patterns.","message":"Only supports dynamic-import, import-statement, and require-call path types.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add platform: 'node' and bundle: true to esbuild build options.","cause":"Missing or incorrect esbuild config options.","error":"Error: The plugin \"esbuild-plugin-wildcard-imports\" only works with platform=node and bundle=true"},{"fix":"Change format to esm or avoid top-level await in dynamically imported files.","cause":"Using dynamic import with top-level await while format is cjs.","error":"Error: Dynamic import with top-level await not supported in CJS format"},{"fix":"Use import wildcardImports from 'esbuild-plugin-wildcard-imports'","cause":"Importing the default export incorrectly (e.g., using namespace import).","error":"TypeError: wildcardImports is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}