Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.

Conversation

@hasanayan
Copy link
Contributor

@hasanayan hasanayan commented Jul 12, 2021

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_RELEASES in addition to SENTRY_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

@hasanayan
Copy link
Contributor Author

@kamilogorek @AbhiPrasad this PR is ready for review now. Is there anything I can do to help you review this?

@kamilogorek
Copy link
Contributor

Thanks, I'll try to review it this week

@kamilogorek
Copy link
Contributor

Code looks mostly fine, however integration tests are failing right now.

(I'll be gone for the next 2 weeks, vacations time)

@hasanayan
Copy link
Contributor Author

@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?

@kamilogorek
Copy link
Contributor

https://github.com/getsentry/sentry-webpack-plugin/blob/master/.github/workflows/ci.yml

npm run test
npm run test:integration

These are only test commands run in the CI.

@hasanayan
Copy link
Contributor Author

@kamilogorek alright, I'll fix the problems in the coming days. Happy vacations.

@hasanayan
Copy link
Contributor Author

re-created this PR in #307

@hasanayan hasanayan closed this Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants