Member-only story
How to Add Multiple Entry Points to Your React App
Often in our application, we require multiple entry points or html pages at our client side user interface. For instance, let’s take a basic scenario where you are making an application that requires a login page, a registration page and your application’s main index page. Though we can handle this requirement with React routing by creating different routes for login, registration and application, it comes with its own set of caveats.
For example, more often than not your login and registration page will have completely different components structure than your main application. And that is why it would be better to have different entry points and code segregation. Though Create React App gives you many out of the box features, it does not support multi entry points functionality, as it is supposed to be a “SPA”.
Having separate unsecured HTML pages for registration and login also makes it a lot easier to handle server side logic for security.
So in this article I will describe the detailed steps to transform your Single Page CRA generated React App to a multi entry point application.
The first step is to eject your React app so that you can configure your Webpack.