@lazuee/bun-plugin-import-glob
v1.0.1
Published
A Bun plugin that support import.meta.glob imports
Readme
bun-plugin-import-glob
bun-plugin-import-globis a Bun plugin that supportimport.meta.globimports.
Installation
Install the package:
bun add -D @lazuee/bun-plugin-import-globUsage
Bundler Plugin
Add the plugin to your build configuration:
import { importGlobPlugin } from "@lazuee/bun-plugin-import-glob";
await Bun.build({
plugins: [importGlobPlugin()],
// ...
});Runtime Plugin
Add the plugin to your bunfig.toml to use it at runtime:
preload = ["@lazuee/bun-plugin-import-glob/runtime"]TypeScript Configuration
Add the following to your tsconfig.json:
{
"compilerOptions": {
"types": [/* ... */ "@lazuee/bun-plugin-import-glob/global"]
}
}Example
Without Eager
const result = import.meta.glob("./*.ts")
/* becomes
const result = {
"./runtime.ts": () => import("./runtime.ts"),
"./index.ts": () => import("./index.ts")
};
*/With Eager
const result = import.meta.glob("./*.ts", {
eager: true,
})
/* becomes
import * as _import_meta_glob_2 from "./index.ts";
import * as _import_meta_glob_ from "./runtime.ts";
const result = {
"./runtime.ts": _import_meta_glob_,
"./index.ts": _import_meta_glob_2
};
*/License
This project is licensed under the MIT License - see the LICENSE.md file for details
Copyright © 2026 lazuee
