UNPKG

444 BMarkdownView Raw
1# `@velcro/resolver`
2
3A tool for resolving require paths to the canonical url of the asset using a generic `ResolverHost` interface.
4
5## Usage
6
7```js
8// host is an implementation of the ResolverHost interface
9const resolver = new Velcro.Resolver(host, {
10 packageMain: ['browser', 'main'],
11 extensions: ['.js', '.json'],
12});
13
14const url = await resolver.resolve('https://unpkg.com/react@16');
15// --> https://unpkg.com/react@16.8.5/index.js
16```