You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+277
Original file line number
Diff line number
Diff line change
@@ -294,3 +294,280 @@ The URL for the React app started this way would look like:
294
294
There is no universal approach to run any React app as child app in Single SPA. This is because unlike Angular application which always use Angular CLI, each React application has it's own Webpack config. And to be able to run React app as a child microapp we need the Webpack to be configured in a certain way.
295
295
296
296
- Here is Official Video form the creator of Single Spa on [How To Convert a create-react-app (CRA) project to single-spa](https://www.youtube.com/watch?v=W8oaySHuj3Y&list=PLLUD8RtHvsAOhtHnyGx57EYXoaNsxGrTU)
and create a folder (ex: 'auth0-local-login'), and save the following file: 'https://accounts-auth0.topcoder-dev.com/setupAuth0WithRedirect.js' into that folder. After 'setupAuth0WithRedirect.js' file was saved, create an empty 'index.html' file with the following content:
there is a config file: '{navbar-app-repo}/config/development.js'. To login locally, change 'ACCOUNTS_APP_CONNECTOR', and 'AUTH' to point to the server that will be served in folder 'auth0-local-login' which was setup in the previous step.
342
+
```
343
+
URL: {
344
+
ACCOUNTS_APP_CONNECTOR: "http://localhost:5000",
345
+
AUTH: "http://localhost:5000"
346
+
...
347
+
}
348
+
```
349
+
install dependencies:
350
+
- npm install
351
+
build and run the app (choose 1 out of 3 ways listed bellow):
352
+
for development build with hot-reload:
353
+
- npm run dev
354
+
or
355
+
for development build with static server:
356
+
- APPMODE=development npm run build
357
+
- npm start
358
+
or
359
+
for production build with static server:
360
+
- npm run build
361
+
- npm start
362
+
NOTE:
363
+
Default backend environment is always the dev environment. To switch to production environment, add APPENV=production before the command, ex:
364
+
- APPENV=production npm run dev
365
+
or
366
+
- APPENV=production npm run build
367
+
- npm start
368
+
(3). react-app:
369
+
open Terminal #3
370
+
change the current dir to the react-app folder and apply patch:
and create a folder (ex: 'auth0-local-login'), and save the following file: 'https://accounts-auth0.topcoder-dev.com/setupAuth0WithRedirect.js' into that folder. After 'setupAuth0WithRedirect.js' file was saved, create an empty 'index.html' file with the following content:
there is a config file: '{navbar-app-repo}/config/development.js'. To login locally, change 'ACCOUNTS_APP_CONNECTOR', and 'AUTH' to point to the server that will be served in folder 'auth0-local-login' which was setup in the previous step.
474
+
475
+
```
476
+
477
+
URL: {
478
+
479
+
ACCOUNTS_APP_CONNECTOR: "http://localhost:5000",
480
+
481
+
AUTH: "http://localhost:5000"
482
+
483
+
...
484
+
485
+
}
486
+
487
+
```
488
+
489
+
install dependencies:
490
+
491
+
- npm install
492
+
493
+
build and run the app (choose 1 out of 3 ways listed bellow):
494
+
495
+
for development build with hot-reload:
496
+
497
+
- npm run dev
498
+
499
+
or
500
+
501
+
for development build with static server:
502
+
503
+
- APPMODE=development npm run build
504
+
505
+
- npm start
506
+
507
+
or
508
+
509
+
for production build with static server:
510
+
511
+
- npm run build
512
+
513
+
- npm start
514
+
515
+
NOTE:
516
+
517
+
Default backend environment is always the dev environment. To switch to production environment, add APPENV=production before the command, ex:
518
+
519
+
- APPENV=production npm run dev
520
+
521
+
or
522
+
523
+
- APPENV=production npm run build
524
+
525
+
- npm start
526
+
527
+
(3). react-app:
528
+
529
+
open Terminal #3
530
+
531
+
change the current dir to the react-app folder and apply patch:
0 commit comments