1.0.0 • Published 10 years ago

browser-resolve-sync v1.0.0

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

browser-resolve-sync Build Status

Node.js resolve algorithm with browser field support.

This is 1:1 port of Roman Shtylman's asynchronous browser-resolve module.

API

resolve(pkg, opts={})

Resolve a module and return the full path.

Options:

  • filename - the calling filename where the require call originated (in the source)
  • paths - require.paths array to use if nothing is found on the normal node_modules recursive walk
  • packageFilter - transform the parsed package.json contents before looking at the "main" field
  • modules - object with module id/name -> path mappings to consult before doing manual resolution (use to provide core modules)
  • extensions - array of file extensions to search in order

License

MIT