single-spa / single-spa-react

Single-spa lifecycles helper for React applications
https://single-spa.js.org/docs/ecosystem-react.html
MIT License
227 stars 63 forks source link

package.json exports causes problems with some environments #140

Closed kevintap-idemia closed 1 year ago

kevintap-idemia commented 2 years ago

The exports block in package.json for single-spa-react is incomplete and can cause problems in certain environments.

We have a rather complicated build process for one of our projects that is using strapi. The strapi build process has a parser that examines the dependencies of the project and attempts to extract details from the package.json file from each of the dependencies. I'm not 100% sure what it does with this data or how it's used by the build process. (Note, strapi has implemented a work-around for this in the latest 4.0.4 release.)

However, due to the exports block in package.json for single-spa-react, this is not compatible. Since package.json is not explicitly listed in the exports, it cannot be found/loaded if the single-spa-react package.json is attempted to be loaded by a require statement. The exports block should list package.json as an export from the single-spa-react package.

There are other exports that should also be allowed, such as "index", etc. See the description here: https://nodejs.org/api/packages.html#package-entry-points Specifically the note about "To make the introduction of "exports" non-breaking".