coexisting-angular-microfrontends
coexisting-angular-microfrontends copied to clipboard
After building , navigating to "app1" gives 404
Hi @joeldenning @Vallerious ,
- cd navbar && npm ci && npm run build:single-spa
- cd ../app1 && npm ci && npm run build:single-spa
- cd ../app2 && npm ci && npm run build:single-spa
- cd .. && mkdir static && cp -a navbar/dist app1/dist app2/dist static
- cp root-html-file/index.html static
- sed -i 's/http://localhost:4201/main//dist/app1/main/g' static/index.html
- sed -i 's/http://localhost:4202/main//dist/app2/main/g' static/index.html
- sed -i 's/http://localhost:4300/main//dist/navbar/main/g' static/index.html
- cp static/index.html static/200.html
- echo "The static directory uploaded to surge:"
- find static
i tried to build by using above steps, i've got my static folder ready, When i put static folder inside apache or other server, I was able to load initial page properly. The issue is when i navigate to '/app1' or '/app2' 'm getting 404 error.
Can you please help.
Hi @ajaykumarsana ! You would have to tell apache to serve the index.html on every request, no matter if it's /app1, /app2, /, /some-other. single-spa-router would take care of the in-app routing.
By the way, you have double slashes in your sed
command (http://localhost:4201/main//dist/app1/main/g). How does that work?
Hi @ajaykumarsana ! You would have to tell apache to serve the index.html on every request, no matter if it's /app1, /app2, /, /some-other. single-spa-router would take care of the in-app routing.
By the way, you have double slashes in your
sed
command (http://localhost:4201/main//dist/app1/main/g). How does that work?
Hi @Vallerious , Thanks for response, i manually replaced 'http://localhost:4201/main.js' with '/dist/app1/main.js' . And Could you please tell me how to tell apche to serve index.html for every request?
@Vallerious , @joeldenning Any solution?