Skip to content

feat(build): Add rollup config for Node bundles #5142

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 5 commits into from
May 20, 2022

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented May 20, 2022

Currently, we have the ability to create rollup configs for two types of bundles, both intended for use in the browser: standalone SDKs (like browser or vue) and SDK add-ons (like integrations). This adds a third option, namely bundles for Node. Though it's clearly a less-common use case, there are Node situations (like serverless functions) where having a single, fully-treeshaken file could be helpful. (Indeed, the reason for this addition is our AWS lambda layer, and a desire for a simpler and more robust way to make sure that it includes all of the necessary dependencies without a lot of unnecessary extras.)

Adding this option required a small amount of refactoring - exchanging a boolean indicator of bundle type for a string option, and switching to a(n admittedly slightly hacky) sorting mechanism for ordering plugins rather than manually inserting specific plugins at various spots in the array. (This was necessary because adding the node config meant shifting plugins around in such a way that it became impossible to merge plugin arrays by simple concatenation. As a bonus side effect, it allowed the insertion logic to be removed as well.)

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.41 KB (-3.61% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.11 KB (-6.97% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.26 KB (-3.19% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 53.8 KB (-7.2% 🔽)
@sentry/browser - Webpack (gzipped + minified) 20 KB (-13.92% 🔽)
@sentry/browser - Webpack (minified) 63.34 KB (-22.49% 🔽)
@sentry/react - Webpack (gzipped + minified) 20.03 KB (-13.96% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 43.5 KB (-9.48% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.1 KB (-3.75% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.63 KB (-3.49% 🔽)

@lobsterkatie lobsterkatie merged commit 263257f into 7.x May 20, 2022
@lobsterkatie lobsterkatie deleted the kmclb-add-node-rollup-bundling branch May 20, 2022 07:03
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
Currently, we have the ability to create rollup configs for two types of bundles, both intended for use in the browser: standalone SDKs (like browser or vue) and SDK add-ons (like integrations). This adds a third option, namely bundles for Node. Though it's clearly a less-common use case, there are Node situations (like serverless functions) where having a single, fully-treeshaken file could be helpful. (Indeed, the reason for this addition is our AWS lambda layer, and a desire for a simpler and more robust way to make sure that it includes all of the necessary dependencies without a lot of unnecessary extras.)

Adding this option required a small amount of refactoring - exchanging a boolean indicator of bundle type for a string option, and switching to a(n admittedly slightly hacky) sorting mechanism for ordering plugins rather than manually inserting specific plugins at various spots in the array. (This was necessary because adding the node config meant shifting plugins around in such a way that it became impossible to merge plugin arrays by simple concatenation. As a bonus side effect, it allowed the insertion logic to be removed as well.)
@AbhiPrasad AbhiPrasad added this to the 7.0.0 milestone May 30, 2022
lobsterkatie added a commit that referenced this pull request Jun 2, 2022
…iant config (#5192)

This restores the plugin which includes debug logging in the configuration for our `.debug.min` bundles. (It was accidentally dropped in #5142.)
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