1.1.1 • Published 8 years ago
@nore/resolve v1.1.1
@nore/resolve
Resolve a module request, returning the absolute path of the file.
Installation
$ npm install @nore/resolveUse:
import resolve from '@nore/resolve'
const file = resolve({
request: 'components/button',
path: '/path/to/project',
extension: '.css',
parent: '/path/to/project/source/app/index.js',
})Options:
request— the module request that should be resolvedpath— the absolute path of the project, to match local modulesextension— the extension of the file is being requestedparent— the absolute path to the file from which the request was made (optional)
request formats:
- absolute paths:
/some/path/to/file.extension/path/to/folder
- relative paths:
./path/to/file.extension./path/to/folder../folder/file.extension../path/to/folder
- local modules, relative to project
path:path/to/file.extensionpath/to/folder
- modules, loaded from the
node_modulesfolder:jquery
For example if a request is /path/to/name and a file and folder exists with the same name, the file name.ext has priority.