paths
- Type:
Record<string,string> | ((id) =>string) - Optional
Maps external module IDs to paths. The ID does not include import attributes.
Allows customizing the path used when importing external dependencies. This is particularly useful for loading dependencies from CDNs or custom locations.
- Object form: Maps module IDs to their replacement paths
- Function form: Takes a module ID and returns its replacement path
Examples
js
{
paths: {
'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
}
}js
{
paths: (id) => {
if (id.startsWith('lodash')) {
return `https://cdn.jsdelivr.net/npm/${id}`
}
return id
}
}