-
Couldn't load subscription status.
- Fork 116
Add Module Federation Support #291
Add Module Federation Support #291
Conversation
thi plugin now injects additional SENTRY_RELEASES variable into global scope as an object that holds versions for all apps keyed by [project]@[org]
…thub.com/hasanayan/sentry-webpack-plugin into feature/enable-module-federation-support
|
@kamilogorek @AbhiPrasad this PR is ready for review now. Is there anything I can do to help you review this? |
|
Thanks, I'll try to review it this week |
|
Code looks mostly fine, however integration tests are failing right now. (I'll be gone for the next 2 weeks, vacations time) |
|
@kamilogorek it's been a while since I looked at the code, can I run these tests locally? Otherwise, could you grant me permission to run the tests whenever I push code to this branch? |
|
https://github.com/getsentry/sentry-webpack-plugin/blob/master/.github/workflows/ci.yml These are only test commands run in the CI. |
|
@kamilogorek alright, I'll fix the problems in the coming days. Happy vacations. |
|
re-created this PR in #307 |
TL;DR;
the plugin now injects additional SENTRY_RELEASES variable into global scope as an object that holds versions for all apps keyed by [project]@[org]
When ModuleFederationPlugin is used, assuming the project has a single entry in the webpack config, the build outputs a bundle with two separate entrypoints; usually named as 'main' and 'remoteEntry'. Main is used when the app is running in standalone (host) mode and remoteEntry is used when it is consumed as a remote by another app. In our projects we needed to access the version value for all remotes on our host app so that we can create SentryClient per remote with their own respective versions.
With this PR, the code injected by loader is improved to include a second variable
SENTRY_RELEASESin addition toSENTRY_RELEASE. This code goes to main module and is not loaded when the app is running as remote. So I also added the part to tap into compilation and inject the variable in remoteEntry as well.If this is accepted, we can maybe open another PR on @sentry/browser so that the default release is read from SENTRY_RELEASES and retire SENTRY_RELEASE