nuxt / nuxt/ui

[Docs] Add Module Federation example for Vue + Vite SPA

Open
#6,452 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
6.9k
Forks
1.1k
Avg merge
1d 7h
Merged PRs (30d)
57

Description

Package

v4.x

Description

While experimenting with Nuxt UI for upcoming B2B/B2E projects, I tried to integrate it with Module Federation and ran into several non-obvious issues that caused incorrect behavior of toast notifications and programmatic overlays:

  1. @nuxt/ui contains build-time code that causes errors when added to shared in Module Federation config
  2. @nuxt/ui uses createSharedComposable internally, whose state is isolated between host and remote by default

I managed to work around both issues. The core of the solution is:

  • Adding the following packages to shared: vue, reka-ui, @nuxt/ui/composables, @vueuse/core, @vueuse/shared
  • Using a single <UApp> in the host app only; remotes render <UApp> only in standalone mode

Assumptions and limitations:

  • Nuxt UI configuration is identical across all micro-frontends
  • Tailwind CSS class duplication between host and remotes is not addressed, as it is not a priority concern in B2B/B2E context
  • The solution may not be complete — edge cases and bugs are possible

Working example: https://github.com/katrface/nuxt-ui-vite-module-federation-example

I suggest adding a guide based on this example under Getting Started → Integrations — so that teams using Module Federation to decouple release cycles have a verified starting point for integrating Nuxt UI. Open to other suggestions.

Additional context

Stack: @module-federation/vite + Vue + Vite SPA (no SSR)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked working example and the existing Getting Started → Integrations documentation. Verify the Module Federation shared-package setup and the host-only UApp behavior for a Vue + Vite SPA; done means a guide gives users a reproducible starting point and states the listed assumptions and limitations.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, tailwindcss, vite
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.