Build create react apps with relative path

Viewed 182

How I can deploy multiple react apps on same server with CRA and pm2, with relative domain name paths, for example:

https://example.com/1

https://example.com/2

https://example.com/3

If I have reverse-proxy, and I try to navigate to /1 or /2, how to build the app properly with pm2 and build the app properly with yarn build command.

In package.json file, I set the homepage key to override the default and also the<Router />:

package.json

"homepage" "https://example.com/1"

App.tsx

<Router basename='/1'>
 <Link ... />
 <Link ... />
</Router>

By default I'm building and starting the app with with this commands:

yarn build
pm2 serve build 5000 --spa

Br,

0 Answers
Related