DEV Community

Pedro Otero Prada
Pedro Otero Prada

Posted on

 

Can't figure out Single SPA + SystemJS + Code Splitting

Can't seem to figure out how to set up either Webpack or SystemJS to load applications in Single SPA that are split.

It works just fine when I'm not splitting the code of the microapps (ejected CRA). But once I do, I get this error I can't make sense of:

Error

What should I be googling?

Top comments (2)

Collapse
 
frehner profile image
Anthony Frehner

here's a helper library that should solve this problem. github.com/joeldenning/systemjs-we...

TLDR: When you codesplit in webpack, you need to set the public path so that webpack knows where to look for that codesplit - by default it makes assumptions that work in most cases, but not in single-spa situations.

Feel free to check out the docs single-spa.js.org/docs/faq/#code-s... and also join us in the Slack channel linked in the bottom of that page as well.

Collapse
 
bsawyer profile image
Ben Sawyer

"single-spa missing bootsrap function" 🤷

I love the idea of framing a question like this from the perspective of what should I be searching based on my problems context, very cool. Might be a good idea for a stack overflow alternative...

I wonder if there is a service similar to codepen that would allow for sandboxing and sharing frontend builds like this to collaborate on, test and debug? i.e. something a little more accessible than just git cloning. Now that I think about it there was vagrant...

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<