I would like to use this property to remove some dependencies from create-react-app. In my case I already have a page with React and ReactDOM, but I don't have control over them, it's not my project. I will just do some components, to contribuite with this page, so when I generate the build file I don't want React or ReactDOM, only the code for the components. There is another way for to do this ?
I'm going to close this as I feel it's a dupe of #2758.
Short answer, no -- you cannot do this. We're also not exposing external anytime soon; but we want to figure out an "external" method.
If React is already loaded on the page, you should be able to do something like:
const React = window.React
Just never import React yourself.
How about peer dependencies?
import Panel from 'react-bootstrap/lib/Panel' is still causing React to be included in the bundle right?
Yeah, right now there's no work around for that.
You can create a fake react dependency if you'd like (where all it does is module.exports = window.React;).
Then update package.json to reference a file:../react-stub or something.
Most helpful comment
Yeah, right now there's no work around for that.
You can create a fake
reactdependency if you'd like (where all it does ismodule.exports = window.React;).Then update
package.jsonto reference afile:../react-stubor something.