Registry / devops / esbuild-plugin-glob-import

esbuild-plugin-glob-import

JSON →
library0.2.0jsnpmunverified

An esbuild plugin (v0.2.0, stable but low activity) that enables glob patterns in import statements to bundle multiple files as a single module. Differentiates from alternatives like esbuild-plugin-import-glob by supporting `entryPoint` and `camelCase` options for organizing imports into nested objects keyed by directory structure. Built on fast-glob for performance.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM only; CommonJS require will fail as there is no default export for CJS.

import globImport from 'esbuild-plugin-glob-import'

Options interface is only available as a type import; bundling throws error if used at runtime.

import type { GlobImportOptions } from 'esbuild-plugin-glob-import'

The default export is a function; named import is not available.

import globImport from 'esbuild-plugin-glob-import'; esbuild.build({ plugins: [globImport({ camelCase: true })] })

Sets up the plugin with esbuild, enabling glob imports that organize files by directory, with camelCase keys and entry point filtering.

import esbuild from 'esbuild'; import globImport from 'esbuild-plugin-glob-import'; await esbuild.build({ entryPoints: ['src/index.js'], bundle: true, outfile: 'dist/bundle.js', plugins: [ globImport({ camelCase: true, entryPoint: 'index.js' }) ] }); // Now in any file you can do: import pages from './pages/**/index.js'; console.log(pages); // { home: {...}, about: {...}, error: {...} }
Debug
Known footguns
gotchaGlob patterns in import statements are not valid JavaScript; they are resolved at build time and replaced with generated module code. Tooling like TypeScript or ESLint will report errors on the raw import.
breakingPrior to v0.2.0, the plugin required explicit `opts.entryPoint` to be set; default behavior changed to `entryPoint: 'index.js'`.
gotchaThe plugin uses fast-glob under the hood, but that dependency is not listed in package.json peerDependencies. If fast-glob is not installed or version mismatch occurs, builds may fail silently.
gotchaThe `camelCase` option transforms filenames and directory names using lodash.camelCase, which can produce unexpected results for non-standard naming conventions (e.g., 'my-file.js' becomes 'myFile').
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
11 hits · last 30 days
ahrefsbot
4
claudebot
4
gptbot
3
Resources