davideicardi / live-plugin-manager

Plugin manager and installer for Node.JS
MIT License
241 stars 44 forks source link

FR: Support for `"exports"` in `package.json` #82

Open pyhedgehog opened 1 year ago

pyhedgehog commented 1 year ago

Right now if (saltcorn) plugin requires (directly or indirectly), for example require("@saltcorn/db-common/internal") it raises Error: Cannot find ./internal in plugin @saltcorn/db-common, but in node code outsize live-plugin-manager's vm it works.

Docs: https://nodejs.org/api/all.html#all_packages_subpath-exports Example: https://github.com/saltcorn/saltcorn/blob/11742abda9d6145c19d2081d492b9c1231ad61c1/packages/db-common/package.json#L14 Reference implementation: https://github.com/nodejs/node/blob/952cf0d17ae51c644a434684dabf493ccf2ebf38/lib/internal/modules/esm/resolve.js#L567

davideicardi commented 1 year ago

I can confirm that for now it is not supported. If someone want to work on this, PRs are welcome ;-) !