Search code examples
reactjswebpackcdnreact-dom

CDN vs Webpack for React


So I'm attempting to create my first React application, and when I compile it using webpack, I get a pretty large JS file, because it includes all React, React-DOM, etc.

Is there any way I can use one of the many React CDN's out there and still use

import React from "react";
import ReactDOM from "react-dom";

Thanks in advance!


Solution

  • You should look at webpack externals feature: https://webpack.js.org/configuration/externals/

    This was made for this use case.