1.0.4 • Published 5 years ago

module-path-hook v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

module-path-hook

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

Module path hook for Node.js require

Installation

npm install module-path-hook
# or use yarn
yarn add module-path-hook

Usage

/**
  app/
    index.js
    foo.js
 */
require('module-path-hook/register')({
  // See webpack resolve: https://webpack.docschina.org/configuration/resolve/
  alias: {
    '@app': '/app/'
  }
})

require.resolve('@app') === '/app/index.js'
require.resolve('@app/foo') === '/app/foo.js'

Related

Contributing

  • Fork it!
  • Create your new branch:
    git checkout -b feature-new or git checkout -b fix-which-bug
  • Start your magic work now
  • Make sure npm test passes
  • Commit your changes:
    git commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'
  • Push to the branch: git push
  • Submit a pull request :)

Authors

This library is written and maintained by imcuttle, imcuttle@163.com.

License

MIT - imcuttle 🐟