Registry / devops / esbuild-plugin-import-glob

esbuild-plugin-import-glob

JSON →
library0.1.1jsnpmunverified

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.

npm install esbuild-plugin-import-glob
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-IMP
E
esbuild-plugin-import-glob
devopsjavascriptv0.1.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default
✓ import ImportGlobPlugin from 'esbuild-plugin-import-glob';
✗ const ImportGlobPlugin = require('esbuild-plugin-import-glob');
Default export is a function that creates the plugin instance.
glob import (default)
✓ import migrationsArray from './migrations/**/*';
✗ const migrationsArray = require('./migrations/**/*');
When using default import, each module's default export is collected into an array.
glob import (namespace)
✓ import * as migrations from './migrations/**/*';
✗ import migrations from './migrations/**/*';
Namespace import yields an object with 'default' (array of modules) and 'filenames' (array of paths).

Shows how to set up the plugin in an esbuild build script and use glob imports in source files.

// esbuild script const esbuild = require('esbuild'); const ImportGlobPlugin = require('esbuild-plugin-import-glob'); esbuild.build({ entryPoints: ['src/index.ts'], bundle: true, outfile: 'out.js', plugins: [ ImportGlobPlugin(), ], }).catch(() => process.exit(1)); // usage in source file (e.g., src/index.ts) // @ts-ignore import migrationsArray from './migrations/**/*'; console.log(migrationsArray); // array of module default exports // @ts-ignore import * as migrations from './migrations/**/*'; console.log(migrations.default); // same as above console.log(migrations.filenames); // file paths
Debug
Known issues
gotchaTypeScript will complain about glob import paths with @ts-ignore.
fix
Add // @ts-ignore above each glob import statement.
affects: >=0.0.0
gotchaPlugin version 0.1.1 is very early; API may break without major version bump.
fix
Pin to exact version and test updates thoroughly.
affects: >=0.0.0
breakingGlob patterns are resolved at build time; dynamic imports with variables are not supported.
fix
Use a literal string for the glob pattern.
affects: >=0.0.0
Errors
Common errors & fixes
Error: The plugin 'esbuild-plugin-import-glob' is not compatible with esbuild version X.X.X
Plugin may depend on esbuild internals that change between versions.
fix
Check plugin's peerDependencies and use a compatible esbuild version.
TypeError: Cannot read properties of undefined (reading 'default')
Accessing default export from import * as X when module has no default export.
fix
Ensure each matched file has a default export, or use namespace import and access properties directly.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-import-glob — npm install esbuild-plugin-import-glob · libregistry