1

I have a create-react-app project where I am creating a front side for users and an admin side, and want this two sides to use the same code base and run on one time instead of building two separate apps and each will use a different theme and files.

As suggested in some places I have ejected my create-react-app App and then tried adding a different entry point as suggested in this tutorial:

http://imshuai.com/create-react-app-multiple-entry-points/

but when i navigate to /admin nothing happens...any suggestions?

I am using react-router-dom as well.

user1102152
  • 61
  • 1
  • 8
  • Here is an example on how to get CRA working with version 3: https://github.com/DanZeuss/create-react-app-multiple-entry-points – Dan Dec 26 '19 at 21:27

1 Answers1

0

When you navigate to /foo Webpack dev server has a little convenience feature to consider /foo/index.html as well if /foo does not exist. This is probably meant to be compatible with the user's expectations of other HTTP servers (i.e. Apache, Nginx). This means that /admin resolves to either something actually called /admin or /admin/index.html if the former is unavailable.

If you did follow the linked tutorial, the path you are looking for is clearly not supposed to be /admin but /admin.html. And your normal 'user' front end remains at /index.html, which is why you can still navigate to it the same way you were used to before ejecting.

Note: I don't speak Japanese, but I do read Webpack, so I just looked at the sample Webpack config and layout of the build/ folder as described in the tutorial.

user268396
  • 10,338
  • 26
  • 25