jsenv / importmap-node-module

Generate importmap for node_modules
35 stars 4 forks source link

Take package exports field value into account in resolvePackageMain #7

Closed dmail closed 4 years ago

dmail commented 4 years ago

https://nodejs.org/dist/latest-v13.x/docs/api/esm.html#esm_package_exports has finally landed in node 13. It means we certainly have to update how resolvePackageMain works.

https://github.com/jsenv/jsenv-node-module-import-map/blob/140babbc14e5e0c746ef661a057e2b9dda1e9377/src/internal/resolvePackageMain.js#L7

We must now take into account packageExports to resolve the main file as documented in https://nodejs.org/dist/latest-v13.x/docs/api/esm.html#esm_exports_sugar.