---
title: "Discussion on \"vite-plugin-single-spa:  Vite Projects Made single-spa Compatible with One Plug-In\" | Hashnode"
description: "Discussion on \"vite-plugin-single-spa:  Vite Projects Made single-spa Compatible with One Plug-In\". 🪦\nUnfortunately, single-spa is no longer maintained. If you would like a Vite-powered replacement, I created CollageJS (https://collagejs.dev). CollageJS is an evolution of single-spa's parcels. Chec"
url: "https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [vite-plugin-single-spa: Vite Projects Made single-spa Compatible with One Plug-In](https://webjose.hashnode.dev/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in?utm_source=hashnode&utm_medium=feed)

🪦 Unfortunately, single-spa is no longer maintained. If you would like a Vite-powered replacement, I created CollageJS (https://collagejs.dev). CollageJS is an evolution of single-spa's parcels. Chec

Aug 3, 2023 · 16 min read · webjose.hashnode.dev  
Updated 3d ago  
Read the article

-   [#single-spa](https://hashnode.com/tag/single-spa)
-   [#vite-plugin-single-spa](https://hashnode.com/tag/vite-plugin-single-spa)
-   [#vite](https://hashnode.com/tag/vite)
-   [#vuejs](https://hashnode.com/tag/vuejs)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

@webJose

  
[View profile](https://hashnode.com/@webJose)

Senior Software Developer @ Intel

## Responses 6

Markdown supported · ⌘↵ to post

[Faizan Muhammad](https://hashnode.com/@faizan-muhammad)

[Jan 2, 2025](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/67761785fd70ba482635acd0)

Hi [José Pablo Ramírez Vargas](https://hashnode.com/@webJose), thanks for great series...

Everyone following this article, if you guys are confused about base... I'm using vite-plugin-single-spa version 0.8.1 and its neither have deployedBase property nor its setting base='[localhost](http://localhost:4041/)', so you manually have to set base='[localhost](http://localhost:4101/)' in your vite.config file

[BRITANY PEDDY](https://hashnode.com/@peddybrit)

[May 14, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6642c08700f1b898e3ee565d)

TROPICAL DELIGHT RECOVERY IS THE ONLY VERIFIED LICENSE COMPANY.

Are you looking for a way to recover cryptocurrency you misplaced or had stolen? I'm pleased to inform that Tropical Delight Recovery Hacker has resolved the issue that nearly caused my house to fall since I spent the monies my spouse wanted to utilise to start a business. I lost $1.4 million in bitcoin and etherium to these scammers. They excel at what they do and are the leading certified cryptocurrency recovery company. They can be reached instantly at: @ tropicaldelightrecoveryhacker on Telegram and @ tropicaldelightrecoveryhacker.93 on Signal. The email address is TropicalDelightRecoveryHacker @ out look .com.

[Philip Hahn](https://hashnode.com/@PDGallus)

[Apr 17, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/661fee1528a923a984025560)

Hi @[José Pablo Ramírez Vargas](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/Jos%C3%A9)! Does your vite plugin provide the possibility of bundle an utility module? I'm asking, because your type property only provides 'root' and 'mifi'.

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Apr 17, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/661fee1528a923a984025560#reply-662045cacdc348532eb6572c)

Utility MFE's provide importable modules, is it not? If this is the case, you don't need the plug-in at all, I would say. Just bundle the module and that's it. You can publish it to a CDN and be done.

Is your utility project different somehow?

[Philip Hahn](https://hashnode.com/@PDGallus)

[Apr 19, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/661fee1528a923a984025560#reply-662228b667928ad893795983)

Hi [José Pablo Ramírez Vargas](https://hashnode.com/@webJose)! No, it's just a normal utility project and was created via create-single-spa --moduleType util-module. But when I try to bundle it with vite, this MFE is not found... In the webpack.config.js, what does the singleSpaDefaults do? Must I follow some kind of pattern in vite, to replace it properly or bundle my project in a single-SPA way?

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Apr 19, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/661fee1528a923a984025560#reply-66228116e59d9e0b464c91f2)

[Philip Hahn](https://hashnode.com/@PDGallus) I don't know webpack, so I cannot help you with this. Anything that create-single-spa creates for me has never even run once for me. Unsure if it is a problem in my PC. It is one of the reasons I quickly moved to an all-Vite solution.

Generally speaking: Utility modules should be bundled and served via a CDN. When more than one MFE import it, it should be added to the root config so it can be shared and is not duplicated. If no UI components are being exported, then you don't need sing-spa stuff anywhere. If there are UI components, it is not a utility project and instead is probably a MFE that exports parcels.

[james](https://hashnode.com/@jamesmilz)

[Apr 9, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/661586716fee4977f844826e)

OTTIENI CERTIFICATI IELTS/TOEFL REALI E AUTENTICI, CERTIFICATI GRE/GMAT, CERTIFICATI OET/PTE

WHATSAPP: +44 7537 185707 WHATSAPP: +44 7537 185707

CERTIFICATO IELTS

CETIFICATO TOEIC

CERTIFICATO Toelf

CERTIFICATO TCF

CERTIFICATO ESOL

CERTIFICATO GMAT

GRE. CERTIFICATO

CERTIFICATO CELTA/DELTA

OET. CERTIFICATO

ASSISTENZA INFERMIERISTICA. CERTIFICATO (RPN, RN)

Contattaci sul nostro sito web al link sottostante

WHATSAPP:+44 7537 185707 WHATSAPP: +44 7537 185707 Acquista certificato registrato, IELTS,TOEIC, Toelf,TCF,ESOL,GMAT,CELTA/

[Philip Hahn](https://hashnode.com/@PDGallus)

[Mar 27, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6604193f20f34137f957e789)

Hello [José Pablo Ramírez Vargas](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/@webJose). During my own journey with single-spa I came across your articles. Thank you for your work and effort to bring vite into single-spa.

In connection with the "standalone" version of the "mife", I stumbled upon a problem that I have not yet been able to solve. What would be the approach if you import a utility module in a "mife". The problem I have is that the import maps for the mife type cannot be set in the plugin and I have not yet figured out how to tell the mife to import this external dependency at runtime.

If I use Webpack, I can import the module manually afterwards using the button (bottom right by default).

Have I overlooked something obvious?

I would be very happy if someone would share their thoughts or suggestions with me. If I get this point solved, then I can switch everything to vite.

Happy Easter to all

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Mar 27, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6604193f20f34137f957e789#reply-66044e4132a4b9a21c5622f2)

Hello, [Philip Hahn](https://hashnode.com/@PDGallus). In Vite, you set any module alias as an external so the build process won't try to bundle its code. This is not enough for Vite in serve mode (`npm run dev`) because serve mode doesn't bundle. What I do is make a small plug-in (really easy to do) that provides a fake module (or even a copy if that's what you need) when working with Vite in serve mode.

If you require further help, [open a discussion item here](https://github.com/WJSoftware/vite-plugin-single-spa/discussions/new?category=q-a) where we have more room to share information and code snippets around.

[Gerald Baldie](https://hashnode.com/@geraldbaldie)

[Feb 24, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/65d9df8b86bc2e4b47feaf97)

Buy High Quality Counterfeit Money/Buy cloned cards online/Buy PayPal Top-up/WhatsApp…..+49 1521 9324117/Telegram: @matrixccc [t.me/thematrixshops/https://thematrixcartel.store](https://t.me/thematrixshops/https://thematrixcartel.store/)

Fake Euro notes and Cloned credit cards available for sale. We also do PayPal transfer Topups. Tap in for more information on our services. Telegram username: @matrixccc [t.me/thematrixshops](https://t.me/thematrixshops) [thematrixcartel.store](https://thematrixcartel.store/) Whatsapp +49 1521 9324117 Ψεύτικα χαρτονομίσματα ευρώ και κλωνοποιημένες κάρτες προς πώληση Ψεύτικα χαρτονομίσματα ευρώ και κλωνοποιημένες πιστωτικές κάρτες προς πώληση. Κάνουμε επίσης PayPal μεταφορά Topups. Πατήστε για περισσότερες πληροφορίες σχετικά με τις υπηρεσίες μας. Όνομα χρήστη Telegram: @matrixccc [t.me/thematrixshops](https://t.me/thematrixshops) Κανάλι Whatsapp +49 1521 9324117

[thematrixcartel.store](https://thematrixcartel.store/)

Buy counterfeit money Grade AAA Quality Counterfeit Money For Sale Buy Greece (EUR €) The Matrix Cartel [thematrixcartel.store](https://thematrixcartel.store/)

WhatsApp…..+49 1521 9324117

[Lukáš Ondrejček](https://hashnode.com/@londrejcek)

[Feb 15, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/65ce0bed2f3e3c5c965ebf30)

Hello, thank you for the series of articles. What you're doing is really great. I've built my POC application and everything works fine as long as I have the console open. As soon as I close the console and reload the page, a white screen appears. Today, I restarted the application according to this article and the problem occurred again. Could you advise what might be the problem? You know, Single SPA, and even your plugin, I'm using the latest versions of everything.

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Feb 15, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/65ce0bed2f3e3c5c965ebf30#reply-65ce2e38a12224c0a0ae9bf8)

Hello. I'll be happy to help out if I can. Go to this [GitHub Discusssions](https://github.com/WJSoftware/vite-plugin-single-spa/discussions) page and start a new discussion. Describe your problem, including error messages you get and links to your repositories. We can take it from there.

[Lukáš Ondrejček](https://hashnode.com/@londrejcek)

[Feb 16, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/65ce0bed2f3e3c5c965ebf30#reply-65cf507bcacf9b6d78d98001)

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

I wrote

[Prajwal Kulkarni](https://hashnode.com/@prajwa1)

[Jan 5, 2024](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6597ac511733eeb34c0e752f)

Hey [José Pablo Ramírez Vargas](https://hashnode.com/@webJose), this is a great article indeed. However, I'm getting `LOAD_ERROR` when I override the import map for my mife for local development and in console there are no errors to further understand the issue. Could you please guide me on how do I go about this? Thank you!

PS: The mife project was created using `create-single-spa`

[Nihir Singh](https://hashnode.com/@iAlwaysForceGitPush)

[Dec 1, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/656a2f3d9475ae5ae8b2bf03)

This package as well as this entire blog is revolutionary and is a core piece in the development of the single-spa framework for Vite!

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Dec 7, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/656a2f3d9475ae5ae8b2bf03#reply-6571f06337f7fa8c1537cb53)

[Dorov Toni](https://hashnode.com/@toni444) Hello. There's nothing special you need to do for your scenario. Yours is just textbook scenario described by single-spa: Simply set the registration for each application to use different routes. That's it.

```
const spas = [
  {
    name: 'price',
    moduleName: '@myApp/price',
    activeWhen: '/price'
  },
  {
    name: 'admin',
    moduleName: '@myApp/admin',
    activeWhen: '/admin'
  }
];

spas.forEach( s => {
  registerApplication({
    name: s.name,
    app: () => import(/* @vite-ignore */ s.moduleName),
    activeWhen: s.activeWhen
  });
});
```

Just like that. Separate routes for each.

[Dorov Toni](https://hashnode.com/@toni444)

[Dec 12, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/656a2f3d9475ae5ae8b2bf03#reply-65783beea7af0fb6a9fea133)

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose) Thank you :) also styles doesn't loaded

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Dec 12, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/656a2f3d9475ae5ae8b2bf03#reply-65787a80a7af0fb6a9018a9d)

[Dorov Toni](https://hashnode.com/@toni444) I have an entire article that explains what needs to be done to load the micro-frontend CSS. Go through it.

Having said that, `vite-plugin-single-spa` can do CSS injection for you.

[Jan Steinhoff](https://hashnode.com/@janstoff)

[Sep 27, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6513d62aa80ded5c381ef3d8)

Hi [José Pablo Ramírez Vargas](https://hashnode.com/@webJose), super helpful series. Especially since there has not been much out there around single-spa that is really up to date. Really like the thoughtful, in-depth approach and you explain very well, I find.

You state in this article that Furthermore, we concluded that it is wasteful to create a UI-less root.

However, following along with the code we do not get to a point where the root is actually a UI, say a Main Navigation for example.

Have you explored this further? I only got started with playing around with it, and there are a few behaviours to do with the routing that are still a bit unclear to me.

So anything you are able to share would be helpful.

Thanks again. And keep up the good work!

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Sep 27, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6513d62aa80ded5c381ef3d8#reply-6514b6ca5d5d746448ea4d53)

Hello, Jan! I am glad you find this helpful. Indeed, from the looks of the search results in Google and Bing, I'm kind of the foremost authority in the subject for now, hehe. So I'll do my best to live up to the expectation.

I have indeed created roots with UI. I haven't played with routers, though. I realize routers may be a pain point, and I bet it is very difficult to reconcile a single-spa project that loads routers from multiple frameworks, like a router in React with a router in Vue. Vue routers seem tricky.

I do have, however, a "play" project in GitHub with a navbar-like UI in Svelte: [github.com/webJose/single-spa-and-svelte](https://github.com/webJose/single-spa-and-svelte)

Feel free to look at it. Again, no router stuff yet in my research, but I have it present. Follow the series as this is not yet over.

[Jan Steinhoff](https://hashnode.com/@janstoff)

[Sep 28, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6513d62aa80ded5c381ef3d8#reply-65155af2f80d7d64789781ad)

Hi again José,

thanks for the swift reply.

The main missing piece in fact was the mount point of the microfrontend.

Which I figured out can be passed to for example singleSpaReact like so: domElementGetter: () => document.getElementById('react-mifo-container')

\[other framework helpers have similar options I believe\]

That way the mount point can be nested easily wherever in your component tree you need it.

And as long as the router of the apps is a browser history based router, it all works great.

i.e. the single-spa setup determines which app handles which paths generally and then the individual apps' figure out which content to display exactly based on the precise url path (+ params).

Cheers, Jan

[José Pablo Ramírez Vargas](https://hashnode.com/@webJose)

[Oct 15, 2023](https://hashnode.com/posts/vite-plugin-single-spa-vite-projects-made-single-spa-compatible-with-one-plug-in/64cb2ff5fc7bd27cda4c77f7/comment/6513d62aa80ded5c381ef3d8#reply-652c47f219c16914b7c7fa1b)

[Jan Steinhoff](https://hashnode.com/@janstoff) Hi! I somehow missed your comment. Yes, that is one way to set the mount position. Generally speaking, you can use a special `single-spa` ID in a block element: `<div id="single-spa-application:mifeName"></div>`, where `mifeName` is the name you give the application in the call to `registerApplication()`.
