-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does single-spa-angular support retrieving apps from a different domain? #58
Comments
I'm glad coexisting-angular-microfrontends worked for you 👍 Different domainsYes. Loading apps from a different domain is possible by changing the index.html file to point to that domain. I don't think you'll run into any CORS issues loading from a different domain since iirc script tags don't have that problem, but if so you'll have to resolve those the same as any other CORS issues. Lazy loadingSee related #44. The plan is to encourage people to use SystemJS@3 to implement lazy loading for applications. So instead of Changing bundle urls dynamically based on environmentThis will also be solved with SystemJS and single-spa-playground. The main concept that makes it possible is import maps. You have a different import map for local vs stage vs prod, which allows you to control which url to download the bundles from. |
Yes, I tried to get it use the script tag. And download the main.js successfully. But then how to register it in singleSPA? Do you have some API to handle it or please give me some demo. |
There are a lot of things that could be causing the issue -- try checking the following things:
|
Try changing |
Loading from different domain is working unless its is lazy loaded. I'm using angular 7 and register application in main app using system js
now the main app is loading, I have no issues here in about-us angular app i have a lazy loaded module for route link '/lazyload'. So when i navigate its trying to load the lazy loaded module from the host of the main app rather than http://localhost:7700. how to resolve this issue |
@gowthamSelvaraj the answer to your question is webpack public path. See related set-public-path.js and systemjs/systemjs#1939 |
Closing because original issue seems to be solved. |
I cloned the coexisting-angular-microfrontends. It works perfectly.
But now I have question about how to register an application from different domain.
Something like
singleSpa.registerApplication('app2', () => download('http://abc/main.abcd.js', 'MyAngulurApp'), location => location.pathname.startsWith('/app2'));
The text was updated successfully, but these errors were encountered: