@eggjs/utils

Utils for all egg projects.
Installation
npm i @eggjs/utils
API
getPlugins(options)
- {String} baseDir - the current directory of application
- {String} framework - the directory of framework
- {String} env - egg environment
getLoadUnits(options)
- {String} baseDir - the current directory of application
- {String} framework - the directory of framework
- {String} env - egg environment
getConfig(options)
- {String} baseDir - the current directory of application
- {String} framework - the directory of framework
- {String} env - egg environment
getFrameworkPath(options)
- {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 - a synchronous function that receives the
original
filepath argument passed to importModule() after POSIX separator
normalization, or a virtual specifier. It does not receive the resolved
absolute file path from importResolve(). Return undefined to fall back to
the normal import path.
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
Contributors

Made with contributors-img.