Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

added sentry-webpack plugin for source maps #1371

Merged
merged 3 commits into from
Sep 8, 2021

Conversation

nenadV91
Copy link
Contributor

@nenadV91 nenadV91 commented Sep 1, 2021

Summary

This will provide source maps support in sentry console which will make easier to debug errors in production.

Screenshot from 2021-09-01 13-56-37

To Test

  • source maps support should be visible in the sentry console after the deployment of source code with this valid sentry authToken

Background

  • the sentry-webpack-plugin will only be added if the REACT_APP_SENTRY_AUTH_TOKEN is defined as a env variable. The value of this variable is the authToken provided by sentry.

@nenadV91 nenadV91 requested a review from a team September 1, 2021 12:42
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2021

  • 🔭 GP Swap: Gnosis Protocol v2 Swap UI

Copy link
Contributor

@W3stside W3stside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Only small concern with the sourcemaps

craco.config.js Outdated
module.exports = function () {
return {
babel: {
plugins: ['@babel/plugin-proposal-nullish-coalescing-operator'],
},
webpack: {
plugins,
devtool: SENTRY_AUTH_TOKEN ? 'source-map' : '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought CRA would create the sourcemaps automatically unless you disable them https://stackoverflow.com/questions/55904292/how-to-generate-sourcemaps-in-create-react-app

Also, would this be disabling the sourcemap if SENTRY_AUTH_TOKEN is not present? note that if it's enabled by default, and u set '' then probably u are killing source map...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was that if we don't define auth token then we do not need/want source maps but seems like react-scripts ignore this and still create source maps. I wasn't going into too much details in the react-scripts config but seems like they are also using source-map value for devtool based on this LINK so maybe we can remove this line, what do you suggest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a sidenote there is a option to disable source-maps with env variable LINK

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is, if it's enabled by default, why do you need to enable it yourself with craco?
But more concerning is, why of there's not SENTRY_AUTH_TOKEN u want to disable it? (instead of leaving the default)

In general, I would think, we always want the sourcemaps. I would leave the default if possible. If we want to disable, we can always use the official ENV var

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed that line. My understanding was that source maps slow build time and also load time (which seems to not be true since they only load if you open dev tools apparently).

@anxolin anxolin added the Auto-merge PRs with this tag will be automatically merged when approved and CI succeeds label Sep 8, 2021
@mergify mergify bot merged commit c9bd468 into develop Sep 8, 2021
nenadV91 added a commit that referenced this pull request Sep 8, 2021
# Summary

This will provide source maps support in sentry console which will make easier to debug errors in production.

![Screenshot from 2021-09-01 13-56-37](https://user-images.githubusercontent.com/34926005/131670516-1d3644ea-8ce5-4a55-9dfd-7b4e127ad6c5.png)


 # To Test

- source maps support should be visible in the sentry console after the deployment of source code with this valid sentry authToken


 # Background

- the sentry-webpack-plugin will only be added if the REACT_APP_SENTRY_AUTH_TOKEN is defined as a env variable. The value of this variable is the authToken provided by sentry.
@alfetopito alfetopito deleted the source-map-in-sentry-support branch September 8, 2021 18:26
This was referenced Sep 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Auto-merge PRs with this tag will be automatically merged when approved and CI succeeds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants