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

feat: Inject global.SENTRY_RELEASE.id into source #20

Merged
merged 4 commits into from
Jan 12, 2018

Conversation

HazAT
Copy link
Member

@HazAT HazAT commented Jan 11, 2018

This is a breaking change, we no longer support compilation hash for now since this would conflict with code injection.

Basically what we do is, we inject

global.SENTRY_RELEASE={};
global.SENTRY_RELEASE.id="#MYHASH#";

into the webpack bundle.

Old comment So I am not really happy with how this works right now.

I wasn't able to inject code during compilation into the source, how it's working now is:

Before compilation I add a fake module to the source containing

global.SENTRY_RELEASE={};
global.SENTRY_RELEASE.id="";

After compilation I iterate over all chunks, and replace the corresponding code on the file system so the result in the compiled file is:

global.SENTRY_RELEASE={};
global.SENTRY_RELEASE.id="#MYHASH#";

I will gladly take advice on how to make it better.

@HazAT HazAT self-assigned this Jan 11, 2018
@codecov-io
Copy link

codecov-io commented Jan 11, 2018

Codecov Report

Merging #20 into master will decrease coverage by 28.71%.
The diff coverage is 39.13%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #20       +/-   ##
===========================================
- Coverage   96.15%   67.44%   -28.72%     
===========================================
  Files           1        1               
  Lines          26       43       +17     
  Branches        3        6        +3     
===========================================
+ Hits           25       29        +4     
- Misses          1       11       +10     
- Partials        0        3        +3
Impacted Files Coverage Δ
src/index.js 67.44% <39.13%> (-28.72%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b61c703...0ae873c. Read the comment docs.

@HazAT HazAT requested review from jan-auer and mitsuhiko January 11, 2018 14:22
@HazAT HazAT merged commit 093e61b into master Jan 12, 2018
@HazAT HazAT deleted the feature/inject-sentry-release branch January 12, 2018 13:50
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.

3 participants