mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 04:49:06 +00:00
add import.meta.glob to new docs location
This commit is contained in:
@@ -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"), ... }` |
|
||||
|
||||
Reference in New Issue
Block a user