Skip to content

Tanstack routers 1.121 breaks @module-federation/vite in vite react project #4516

Description

@tfilo

Which project does this relate to?

Router

Describe the bug

I use multiple projects with module federation. Main host app for module federation shares some libraries with other microfrontends. After build there is generated dist/entry.js with some functions for other modules to load this shared libraries. But after update of tanstack library, this whole section with other files too is missing from build directory. And because of that microfrontend modules are not able to load shared libraries. Reverting to older version 1.120.20 fixes this issue. So I am sure this bug is somehow related to tanstack router library. It somehow breaks vite build process.

Your Example Website or App

tanstack-bug-demo-main.zip

Steps to Reproduce the Bug or Issue

I prepared demo project to reproduce this issue:

  1. Download nad extract this project tanstack-bug-demo-main.zip
  2. cd 1.120
  3. npm install
  4. npm run build
  5. cd ../1.121
  6. npm install
  7. npm run build

now compare dist/entry.js in both projects. Only difference between projects is different version of tanstack library. All other library versions are identical and fixed to specified version numbers.

If you want to try it on your own project:

  1. create vite react-ts project
  2. install @tanstack/react-router @tanstack/router-generator @tanstack/router-plugin of version 1.120.20
  3. install @module-federation/vite
  4. configure vite.config.ts to use module federation and share libraries like react/react-dom
  5. build project and check entry.js file in dist folder
  6. update just @TanStack libraries to 1.121.34 or newer
  7. build prject again and check new entry.js which is now missing shared libraries.
  8. optional if you now include some module federated project, it will fail in runtime because it can't find shared libraries

Expected behavior

Expected to have complete entry.js and possibly other missing files after build with 1.121.x version of library like it was working with 1.120.x and older.

Screenshots or Videos

No response

Platform

  • OS: Linux Ubuntu 24.04 LTS
  • Browser: Does't matter
  • Version: Tanstack Router 1.120.20 -> 1.121.x
  • Nodejs: 22.14.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions