0

I´m using single-spa library (v 5.8.2) with multiple angular projects. When i try to import ngx-quill (library which imports another library (quill.js)), the single spa library replaces the default import url with localhost:9000 (the url root loads into).

network data

I have followed the single-spa instructions to modify the scss url, images and other own elements, but remember that in this case, the import call is made from an external library, which should not be modified.

I have also tried to insert my own interceptor in which, if it detects that specific url, it is replaced by the one I want, but since this call is not REST, it does not go through that one and I cannot modify it.

Is it possible to make single-spa by default modify the routes so that they access the corresponding node_modules?

Thank you!.

1 Answer 1

2

the single spa library replaces the default import url

single-spa does not do anything at build time and is only used in the browser.

What is actually happening is that ng-quill likely makes use of relative references to external assets. This could be in JavaScript (import "./styles.css") or in CSS (@import("./styles.css") but in either case, this means that in the browser the app will try to resolve those. But those URLs being relative means that they're relative to the origin that loaded the asset, which is the root config. That is why you're seeing those URLs.

Is it possible to make single-spa by default modify the routes so that they access the corresponding node_modules?

The answer to this is no, because single-spa is not what is causing this. You need to instead configure your build tool (Webpack is what Angular uses I believe) and handle the processing of those URLs. The single-spa-angular Angular community has documented them here https://single-spa.js.org/docs/ecosystem-angular/#styles

Sign up to request clarification or add additional context in comments.

1 Comment

Hi!. Thanks for the answer.I may have explained it wrong. My problem is not with the css, but with the JS imports inside an external library (node ​​modules.). Thank you very much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.