Search code examples
reactjscreate-react-app

Is it possible to avoid bundling the React library using create-react-app?


Is it possible to avoid bundling the React library during the build when using create-react-app? I would rather load it from a CDN. Otherwise, I will have to use WebPack instead, which is alright but I really to use create-react-app as it keeps everything contained and tidy.

Thanks!


Solution

  • There is a very nice tutorial on doing just that here. The idea is simple, to make clever use of the “rewire” module which may swap in your own “customized” build configurations to override those in the “react-scripts” module’s default configurations that come with create-react-app.

    Here's a link to that tutorial.

    Within your “customized” build configs you can easily ignore certain files, by adding their pattern/path to the “exclude” stub. See this for more details.