-
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Description
Note from Maintainers: see #1492 (comment) for the latest thinking on this.
The Problem
Say I have two sibling CRA apps, Foo and Bar. What is the best practice for sharing a common component, Baz between the two apps?
Scope
It would make sense to have a sibling folder Baz with it's own package.json, and to use npm link to access it from Foo and Bar.
But it seems that npm link has bigger issues, so maybe we should explore alternatives. One example is wml, which simply watches and copies files.
Building
Even when npm link works fine, the JSX in Baz has not been compiled.
Per this discussion, I think we should compile separate modules like Baz independently, but that will require boilerplate such as babel config. CRA helps avoid this for full apps, but we don't yet have create-react-component to help manage the boilerplate of shared components.
Optimizing for Developer Experience
There are a few ways to clean this up, but I'm curious what people think is the current best practice. What is the ideal developer experience?