@speedy-js/config-loader
Version:
An out-of-box config loader with TypeScript support.
47 lines (34 loc) • 1 kB
Markdown
# @speedy-js/config-loader
[](https://npm.im/@speedy-js/config-loader)
An out-of-box config loader with TypeScript support.
## Install
```bash
npm i @speedy-js/config-loader -S
```
## Usage
```js
import { loadConfig } from '@speedy-js/config-loader';
// This load try to load at process.cwd():
// - speedy.config.js
// - speedy.config.ts
// - speedyrc.js
// - speedyrc.ts
const config = loadConfig({
configKey: 'speedy',
});
```
Custom config path:
```js
// This will load `speedy.config.test.js` directly:
const config = loadConfig({
cwd: useScene('config-suffix'),
configKey: 'speedy',
configFile: 'speedy.config.test.js',
});
```
## Credits
`@speedy-js/config-loader` wouldn't exist without the inspirations from following projects:
- [esbuild](https://github.com/evanw/esbuild)
- [bundle-require](https://github.com/egoist/bundle-require)
## License
MIT © [ULIVZ](https://github.com/sponsors/ulivz)