https://github.com/thomaschaaf/esbuild-plugin-import-glob
A esbuild plugin which allows to import multiple files using the glob syntax.
https://github.com/thomaschaaf/esbuild-plugin-import-glob
esbuild esbuild-plugin import import-glob
Last synced: 8 months ago
JSON representation
A esbuild plugin which allows to import multiple files using the glob syntax.
- Host: GitHub
- URL: https://github.com/thomaschaaf/esbuild-plugin-import-glob
- Owner: thomaschaaf
- License: mit
- Created: 2021-03-12T20:24:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:49:22.000Z (over 2 years ago)
- Last Synced: 2025-09-18T13:49:10.331Z (9 months ago)
- Topics: esbuild, esbuild-plugin, import, import-glob
- Language: TypeScript
- Homepage:
- Size: 629 KB
- Stars: 54
- Watchers: 1
- Forks: 9
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esbuild-plugin-import-glob
A esbuild plugin which allows to import multiple files using the glob syntax.
## Basic Usage
1. Install this plugin in your project:
```sh
npm install --save-dev esbuild-plugin-import-glob
```
2. Add this plugin to your esbuild build script:
```diff
+const ImportGlobPlugin = require('esbuild-plugin-import-glob');
...
esbuild.build({
...
plugins: [
+ ImportGlobPlugin(),
],
})
```
3. Use import or require
```typescript
// @ts-ignore
import migrationsArray from './migrations/**/*';
// contains default export
migrationsArray[0].default;
```
```typescript
// @ts-ignore
import * as migrations from './migrations/**/*';
const { default: migrationsArray, filenames } = migrations;
```
```typescript
const { default: migrationsArray, filenames } = require('./migrations/**/*');
```