Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ npm i @eggjs/utils
- {String} baseDir - the current directory of application
- {String} framework - the directory of framework

### `setBundleModuleLoader(loader)`

Register a module loader hook for bundled Egg apps. The hook runs before the
normal `importModule()` resolution path.

- {Function | undefined} loader - receives a POSIX-normalized filepath or
virtual specifier and returns module exports. Return `undefined` to fall back
to the normal import path.
Comment thread
killagu marked this conversation as resolved.
Outdated
Comment thread
killagu marked this conversation as resolved.
Outdated

The bundle loader is stored on `globalThis`, so bundled and external copies of
`@eggjs/utils` share the same loader. Non-`undefined` results follow the same
default export unwrapping rules as `importModule()`, including
`importDefaultOnly`.

## License

[MIT](LICENSE)
Expand Down
Loading