Skip to content
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

fix(serverless): Explicitly export node package exports #7457

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Mar 14, 2023

fixes #7441

A serverless package that is esm only breaks when trying to import our serverless package. This is because in our serverless we combine both wildcard and namespace exports. This confuses our rollup bundler, which causes it to put all of the wildcard exports (from @sentry/node) into default, which means it is not exposed as a top level export.

When users try to use the esm serverless package, they are unable to access exports like captureException or init.

The solution here is to just explicitly export everything from the @sentry/node package. In v8 we have to re-visit this and get rid of the namespace exports, since they don't serve much use, and mean that tree-shaking does not work.

@AbhiPrasad AbhiPrasad self-assigned this Mar 14, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.41 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 63.3 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.98 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 56.21 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.65 KB (0%)
@sentry/browser - Webpack (minified) 67.44 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.68 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 52.09 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 33.66 KB (0%)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26 KB (0%)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.17 KB (0%)
@sentry/replay - Webpack (gzipped + minified) 37.19 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 61.3 KB (0%)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.38 KB (0%)

@AbhiPrasad AbhiPrasad requested review from a team, mydea and Lms24 and removed request for a team March 16, 2023 12:09
@AbhiPrasad AbhiPrasad merged commit b278429 into develop Mar 16, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-serverless-esm-compat branch March 16, 2023 12:12
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.

Sentry.captureException is not a function
2 participants