Skip to content
Closed
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
10 changes: 10 additions & 0 deletions packages/utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ npm i @eggjs/utils
- {String} baseDir - the current directory of application
- {String} framework - the directory of framework

### `setBundleModuleLoader(loader)`

Register a bundle module loader for `importModule()`.
Comment thread
killagu marked this conversation as resolved.
Outdated

- {Function|undefined} loader - called with a POSIX-normalized filepath or virtual specifier before normal module resolution.

Return `undefined` from the loader to fall back to the default import path. Any other return value is treated as a bundle hit and uses the same default export handling as `importModule()`, including `importDefaultOnly` and double-default `__esModule` compatibility.
Comment thread
killagu marked this conversation as resolved.
Outdated

Comment thread
killagu marked this conversation as resolved.
Outdated
Pass `undefined` to clear the registered loader.

## License

[MIT](LICENSE)
Expand Down
Loading