Unable To Require A React Component
Solution 1:
You should not be bundling your components when they are separated out into their own packages. If they are using ES6, it's a good idea to transpile them using Babel as a prepublish step, but you do not need to bundle them.
Think about what the bundle step is doing to your component. It is going through your entry point and pulling in any required dependencies into a single file. That means that your bundle.js result will have pulled in all of react, react-dom, and anything else you required from your component.
Only your main application (which will be requiring the component packages) needs a bundle step. Here, it will resolve all dependencies including those that are nested and pull them together into your app's bundle.js, ensuring that you do not end up with duplicate copies of libraries like react pulled into your app.
Post a Comment for "Unable To Require A React Component"