react-microfrontends / people

The microfrontend for People in the star wars universe
MIT License
22 stars 30 forks source link

Why do we need react here? #20

Closed jpinho closed 2 years ago

jpinho commented 2 years ago

My question is, given react and react-dom are part of the shared-dependencies, why aren't react and react-dom under dev dependencies like rxjs?

joeldenning commented 2 years ago

Bundlers do not care whether things are dependencies or devDependencies, so from a practical standpoint with webpack, it doesn't matter.

When publishing to npm, it does matter whether it's a dependency or devDependency. There are some organizations that publish their microfrontends to npm, so that's a situation to consider and making react and react-dom dependencies there often makes sense.

The rule I generally follow is "devDependency is build-time and dependency is runtime" when I think about dependencies for web apps. If it's in the browser, it's a dependency but if it's just during build/test/lint then it's a devDependency. However, like i said, webpack doesn't enforce this.