Package Exports
- resolvewithplus
- resolvewithplus/resolvewithplus.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (resolvewithplus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
resolvewithplus
resolvewithplus iterates on the resolvewith package for resolving CJS modules following the original node.js spec. resolvewithplus is changed to an ESM module and adds support for ESM import 'name'
resolutions.
When a package exports both ESM and CJS, resolvewithplus
returns the ESM path (tries to). Resolving ESM paths is complex and ESM support will be lacking for edge-cases.
// ESM paths are returned by default rather than CJS paths
resolvewithplus('koa', '/Users/bumble/resolvewith/test/');
// '/Users/bumble/resolvewith/node_modules/koa/dist/koa.mjs'
// A CJS path is returned when the ESM path is not found
resolvewithplus('./testfiles/testscript.js', '/Users/bumble/resolvewith/test/')
// '/Users/bumble/resolvewith/test/testfiles/testscript.js'
// use the older 'resolvewith' package to resolve CJS paths
resolvewith('koa', '/Users/bumble/resolvewith/test/');
// '/Users/bumble/resolvewith/node_modules/koa/lib/application.js'
resolvewithplus caches and reuse results it generates. The first call follows rules to locate the file. Subsequent calls using the values return reults from a key store.