Module to fallback the Node.js require and require.resolve function
npm install require-fallback-middle





> Module to fallback the Node.js require and require.resolve function
It's useful in global cli, Allow Node.js resolve module in process.cwd() (local modules) and global modules.
``bash`
npm install require-fallback-middleor use yarn
yarn add require-fallback-middle
`javascript
import requireFallbackMiddle from 'require-fallback-middle'
const { unhook } = requireFallbackMiddle()
`
#### requireFallbackMiddle(match: Match, fallbackDirs?: string[] | ((id: string, parent: Module, isMain: boolean) => string[]))
- match: The registered module matchfallbackDirs
- : The registered module match (Default: (id, parent) => [process.cwd(), dirname(parent?.filename) || __dirname])
- Returns: require-resolve-hook result
- Fork it!
- Create your new branch:
git checkout -b feature-new or git checkout -b fix-which-buggit commit -am 'feat: some description (close #123)'
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
or git commit -am 'fix: some description (fix #123)'git push`
- Push to the branch:
- Submit a pull request :)
This library is written and maintained by imcuttle, imcuttle@163.com.
MIT - imcuttle 🐟