Skip to content

Add guide for tree shaking in JavaScript #4900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 7, 2022
Merged

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Apr 5, 2022

In getsentry/sentry-javascript#4842 we made the JavaScript SDKs a little bit more tree-shakable.
We now want to explain users how to get rid of debug code if they don't want debug functionality in their code.

PR should not be merged before getsentry/sentry-javascript#4842 is released.

Ref: https://getsentry.atlassian.net/browse/WEB-772

@vercel
Copy link

vercel bot commented Apr 5, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sentry/sentry-docs/8BUibRAVaoWhQo6YLdi2z2Zsbmp5
✅ Preview: https://sentry-docs-git-lforst-js-treeshaking-guide.sentry.dev

@lforst lforst requested a review from lobsterkatie April 5, 2022 07:13
@AbhiPrasad
Copy link
Member

I think this might be important enough that we elevate to it's own page under https://docs.sentry.io/platforms/javascript/configuration/. What do you think?


To mark any debug code as unused, we must replace debug flags in the sentry SDK with `false`. We outlined examples of how to do this in popular toolchains below.

### Tree-shaking Debug Code with webpack
Copy link
Member

Choose a reason for hiding this comment

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

should we hide these for the nextjs platform?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right. For nextjs, only the nextjs config section makes sense. Updated in: 41391dc

Copy link
Contributor

@imatwawana imatwawana left a comment

Choose a reason for hiding this comment

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

The writing here is solid! I've just made a number of edits to follow our style guide. Please ping me for review when you've made updates so I can give it another quick read.

@lforst
Copy link
Contributor Author

lforst commented Apr 5, 2022

I think this might be important enough that we elevate to it's own page under docs.sentry.io/platforms/javascript/configuration. What do you think?

@AbhiPrasad I would currently let it live under troubleshooting. When we figured out the tree shaking stuff a bit more (ie, shaking the tracing in next.js) it suddenly becomes a lot more important and I would consider moving it to its own page.

@AbhiPrasad
Copy link
Member

@AbhiPrasad I would currently let it live under troubleshooting. When we figured out the tree shaking stuff a bit more (ie, shaking the tracing in next.js) it suddenly becomes a lot more important and I would consider moving it to its own page.

The only consequence of this is that we would have to leave a link from the current location to the new one so that users do not get confused - IMO there's not much more to figure out, I'd rather just do it right the first time here.

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

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

Nice. Nothing major on my end - mostly just wordsmithing.

@lforst lforst merged commit f3f4d3b into master Apr 7, 2022
@lforst lforst deleted the lforst-js-treeshaking-guide branch April 7, 2022 12:26
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2022
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.

4 participants