Skip to content

ref(build): Add debug constants in each package individually #4842

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 5, 2022

Conversation

lforst
Copy link
Member

@lforst lforst commented Apr 4, 2022

We've identified that our current way of importing isDebugBuild() from @sentry/utils is difficult some build tooling (ie. weback) to tree shake.

As we want to facilitate tree shaking of unwanted code for users as much as possible, this PR will:

  • Convert the isDebugBuild function to a const IS_DEBUG_BUILD
  • Move that const into the individual packages

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

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

We need to find a place to write this down in the repo. Can we update CONTRIBUTING.md accordingly?

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.21 KB (+0.74% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 65.26 KB (+1.12% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.89 KB (+0.62% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 58.27 KB (+0.55% 🔺)
@sentry/browser - Webpack (gzipped + minified) 23.23 KB (+0.07% 🔺)
@sentry/browser - Webpack (minified) 82.17 KB (-0.34% 🔽)
@sentry/react - Webpack (gzipped + minified) 23.27 KB (+0.07% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.03 KB (+0.06% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.15 KB (+0.66% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.5 KB (+0.41% 🔺)

@lobsterkatie
Copy link
Member

This looks good. My only suggestion would be to explain (in the comment at the top of each flags.ts file) why said file exists in every package, the same way you do in the contribution doc (since people might not think to look there when they have the inevitable question).

@lforst lforst enabled auto-merge (squash) April 5, 2022 07:08
@lforst lforst merged commit 334b097 into master Apr 5, 2022
@lforst lforst deleted the lforst-treeshake-constants branch April 5, 2022 07:28
@AbhiPrasad AbhiPrasad added this to the Pre 7.0.0 Work milestone Apr 6, 2022
billyvg added a commit to getsentry/sentry-replay that referenced this pull request Apr 8, 2022
Replaced with a constant that can be treeshaked. See getsentry/sentry-javascript#4842
billyvg added a commit to getsentry/sentry-replay that referenced this pull request Apr 8, 2022
Replaced with a constant that can be treeshaked. See getsentry/sentry-javascript#4842
lobsterkatie added a commit that referenced this pull request Apr 9, 2022
In #4842, a `flags.ts` file was added to each package to fix logger treeshaking when using webpack. Because of the way that webpack works, this file has to exist separately in each individual package, including in `@sentry/integrations`. It is not itself an integration, though, so we shouldn't be building a separate CDN bundle for it (let alone six versions of one). This fixes the build script so that we're no longer doing that.
Lms24 pushed a commit that referenced this pull request Apr 26, 2022
In #4842, a `flags.ts` file was added to each package to fix logger treeshaking when using webpack. Because of the way that webpack works, this file has to exist separately in each individual package, including in `@sentry/integrations`. It is not itself an integration, though, so we shouldn't be building a separate CDN bundle for it (let alone six versions of one). This fixes the build script so that we're no longer doing that.
lobsterkatie added a commit that referenced this pull request Apr 26, 2022
In #4842, a `flags.ts` file was added to each package to fix logger treeshaking when using webpack. Because of the way that webpack works, this file has to exist separately in each individual package, including in `@sentry/integrations`. It is not itself an integration, though, so we shouldn't be building a separate CDN bundle for it (let alone six versions of one). This fixes the build script so that we're no longer doing that.
lobsterkatie added a commit that referenced this pull request Apr 26, 2022
In #4842, a `flags.ts` file was added to each package to fix logger treeshaking when using webpack. Because of the way that webpack works, this file has to exist separately in each individual package, including in `@sentry/integrations`. It is not itself an integration, though, so we shouldn't be building a separate CDN bundle for it (let alone six versions of one). This fixes the build script so that we're no longer doing that.
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
In #4842, a `flags.ts` file was added to each package to fix logger treeshaking when using webpack. Because of the way that webpack works, this file has to exist separately in each individual package, including in `@sentry/integrations`. It is not itself an integration, though, so we shouldn't be building a separate CDN bundle for it (let alone six versions of one). This fixes the build script so that we're no longer doing that.
mydea pushed a commit that referenced this pull request Nov 23, 2022
Replaced with a constant that can be treeshaked. See #4842
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants