Skip to content

Usage of vite-federation-plugin with Nuxt 3 in SSR mode #239

@hlassiege

Description

@hlassiege

Versions

  • vite-plugin-federation: v1.1.9
  • vite: v3.0.9

Reproduction

https://github.com/hlassiege/nuxt-vite-federation-plugin

Steps to reproduce

First of all, thanks a lot for this plugin. I'd like to use it with Nuxt 3 and Vite is the default builder.

To reproduce :

What is Expected?

The application should launch successfully and display the remote component.

It's important to note that it's possible to make this example work if :

  • shared: ['vue'] is removed, hence we don't optimize bundle size
  • we disable SSR but it defeat the goal of nuxt

What is actually happening?

When the application start, there is cryptic error :

 ERROR  Cannot read properties of undefined (reading '_optimizeDepsMetadata')          

Then when attempting to go to http://localhost:3000 we have the following error in the log

[nitro] [dev] [unhandledRejection] TypeError: Cannot read properties of undefined (reading 'stubModule')
at __instantiateModule__ (file:///C:/Dev/src/divers/micro-frontend/app-front/.nuxt/dist/server/server.mjs:3932:11)
at __ssrLoadModule__ (file:///C:/Dev/src/divers/micro-frontend/app-front/.nuxt/dist/server/server.mjs:3923:25)
at ssrImport (file:///C:/Dev/src/divers/micro-frontend/app-front/.nuxt/dist/server/server.mjs:3948:13)
at ssrDynamicImport (file:///C:/Dev/src/divers/micro-frontend/app-front/.nuxt/dist/server/server.mjs:3959:12)
at file:///C:/Dev/src/divers/micro-frontend/app-front/.nuxt/dist/server/server.mjs:2984:11

I don't know if it's only a configuration issue or something more important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions