Skip to content

joshacheson/sentry-vite-module-federation-bug-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentry Vite Plugin + Module Federation Bug Reproduction

This is a minimal reproduction case demonstrating a bug where the Sentry Vite Plugin's telemetry feature breaks Vite's Module Federation chunk splitting.

Setup

⚠️ Before running, configure Sentry credentials in host/vite.config.ts:

  • org: Your Sentry organization slug
  • project: Your Sentry project slug
  • authToken: Your Sentry auth token

Install dependencies:

pnpm install -r

Usage

1. Run Automated Reproduction Test

Builds both versions and compares the output:

pnpm run test-reproduction

This will build:

  • Remote app
  • Host with telemetry: falsehost/dist-telemetry-off/
  • Host with telemetry: truehost/dist-telemetry-on/

Then checks if loadShare files exist in both builds. With telemetry OFF, loadShare files should exist. With telemetry ON, they will be missing (bug reproduced).

2. Preview Builds in Browser

Test the build without telemetry (should work):

pnpm run preview:telemetry-off

Opens http://localhost:5000

Test the build with telemetry (will fail):

pnpm run preview:telemetry-on

Opens http://localhost:5002

The preview commands automatically start both remote and host servers. Press Ctrl+C to stop.

The Bug

When telemetry: true (the default), Sentry's plugin causes Vite to incorrectly merge Module Federation chunks. The host_mf_*__loadShare__react__loadShare__*.js chunk disappears, breaking shared module loading at runtime.

Workaround: Set telemetry: false in the Sentry plugin config.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published