How to use one React codebase to manage multiple domains???


(Steve Dukes) #1

Hi all,
We are using React 16.3 for two of our sites.
Each site displays different content, different layouts, and components but both use the same business logic.
We’d like to create more sites for different brands.

But, if we decide to add more sites, then the React code base will grow dramatically. This could lead to one gigantic build that supports all of our sites. This is not what we want, obviously.

So, we tossed around a couple ideas. This one seems the most promising.
Can webpack create different builds for different domains all from one code base?
Our current version of Webpack is 3.10.0.

We are still learning React and Webpack and would like to know if anyone has tackled this type of problem.
If so, how did you implement it?

Another one of our issues is that we built our application on top of a boilerplate, but we have stopped taking updates because our needs are different. We know that we have components in node_modules included in our build that we really don’t use. The developers here did not build the React app that we have. So there’s that.

I would greatly appreciate input that could help us solve this issue.
Thanks!