From what I understand if you were to create a react app without a starter kit e.g create-react-app, one of things you have full control of is webpack.
This is comes in particularly handy when you need to solve the problem when your app hits a route before the app is fully loaded.
https://your-app.com/login
You'll get an error because your routes haven't been created.
So you do something like this:
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var webpack = require('webpack');
var config = {
  output: {
    publicPath: '/',
  }
  devServer: {
    historyApiFallback: true,
  }
  mode: 'development',
};
if (process.env.NODE_ENV === 'production') {
  config.plugins.push(
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      },
    }),
    new UglifyJSPlugin()
  );
}
module.exports = config;
Specifically:
   devServer: {
        historyApiFallback: true,
      }
So I found this enter link description here based on this related question
Any ideas, if there is package or TUT to solve this problem?