Search code examples
jqueryangularfont-awesomesingle-spasingle-spa-angular

Font Awesome and JQuery are not working in Single SPA Angular app


I have created a single-spa angular app in which i have installed font-awesome and jquery and bootstrap using "npm install --save bootstrap [email protected] font-awesome". After that i have provided the url of this js and css inside angular.json file so the problem i am facing is jquery and font-awesome working fine when I am running this application in normal angular mode but the problem occur when i try to run this application in Single-spa mode. In single-spa mode jQuery and font-awesome not working but i am not able to understand that my bootstrap style is working but why i am facing problem with font-awesome even i have provided the font-awesome url in angular.json file in a same way like i am providing url for bootstrap.

Note: I have created this single spa angular application by running "ng add single-spa-angular" command inside root folder of already existing angular app.

We can run app in normal angular mode using "ng serve -o" command. But to run this application in single-spa mode we have to run this command "npm run serve:single-spa:".

Thanks


Solution

  • There are 2 solutions here

    • import the Jquery inside main.single-spa.ts file.
    • or add the JQuery as a shared dependency inside your root config app