From bb81ebd0fb31ae762b804de1a9ba9b3044644ea8 Mon Sep 17 00:00:00 2001 From: RiskyMH Date: Mon, 1 Dec 2025 16:27:03 +1100 Subject: [PATCH] add import.meta.glob to new docs location --- docs/runtime/module-resolution.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/runtime/module-resolution.mdx b/docs/runtime/module-resolution.mdx index b68291a155..5c7d31f8da 100644 --- a/docs/runtime/module-resolution.mdx +++ b/docs/runtime/module-resolution.mdx @@ -359,6 +359,8 @@ import.meta.main; // `true` if this file is directly executed by `bun run` // `false` otherwise import.meta.resolve("zod"); // => "file:///path/to/project/node_modules/zod/index.js" + +import.meta.glob("./src/*.ts"); // => { "./src/a.ts": () => import("./src/a.ts"), ... } ``` | Property | Description | @@ -372,3 +374,4 @@ import.meta.resolve("zod"); // => "file:///path/to/project/node_modules/zod/inde | `import.meta.main` | Indicates whether the current file is the entrypoint to the current `bun` process. Is the file being directly executed by `bun run` or is it being imported? | | `import.meta.resolve` | Resolve a module specifier (e.g. `"zod"` or `"./file.tsx"`) to a url. Equivalent to [`import.meta.resolve` in browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta#resolve). Example: `import.meta.resolve("zod")` returns `"file:///path/to/project/node_modules/zod/index.ts"` | | `import.meta.url` | A `string` url to the current file, e.g. `file:///path/to/project/index.ts`. Equivalent to [`import.meta.url` in browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta#url) | +| `import.meta.glob` | Import multiple modules using glob patterns. Returns an object mapping file paths to lazy-loading functions. Example: `import.meta.glob("./src/*.ts")` returns `{ "./src/a.ts": () => import("./src/a.ts"), ... }` |