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

build(replay): Stop preserving modules #6817

Merged
merged 2 commits into from Jan 18, 2023
Merged

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 17, 2023

Previously, when transpiling Replay, we preserved modules, just like in every other SDK of ours. In the case of Replay, however, we don't just rely on external dependencies but we want to include a patched version of rrweb in our NPM package. This lead to problems with specific bundler/build tool setups as reported in (#6690).

With this PR, we don't preserve modules any longer, meaning, everything is bundled into one index.js file (similarly to CDN bundles).

Just so that we're all aware: This is a breaking change for anyone who imports from explicit paths (e.g. import { something } from '@sentry/replay/utils/test'). However, we considered this okay in the past (e.g. #6707) as it is not something we instruct people to do in our docs and it is kind of an edge case. Given that Replay isn't fully stable yet, I'd vote it's an okay change to make right now.

Tested this change locally with a plain-js test app.

fixes #6690

@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.82 KB (+0.01% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 61.47 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.5 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.77 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.21 KB (-0.05% 🔽)
@sentry/browser - Webpack (minified) 66.17 KB (+0.01% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.24 KB (-0.01% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.47 KB (-0.09% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.73 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.02 KB (+0.01% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.12 KB (-0.82% 🔽)
@sentry/replay - Webpack (gzipped + minified) 37.82 KB (-2.62% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.35 KB (-0.6% 🔽)

@Lms24 Lms24 marked this pull request as ready for review January 17, 2023 17:47
@Lms24 Lms24 requested review from mydea and billyvg January 18, 2023 11:22
// * build/npm/esm/node_modules/rrweb/...
// * build/npm/esm/packages/replay/...
preserveModulesRoot: path.join(process.cwd(), 'src'),
preserveModules: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

While this is the default value for rollup configs; we need to set it explicitly here because makeBaseNPMConfig sets it to true.

// from there. The current setting (false) prevents this, in case we want to leave it there for users to use in
// their own bundling. That said, we don't yet know for sure that that works, so come back to this.
// treeshake: 'smallest',
treeshake: false,
Copy link
Member Author

@Lms24 Lms24 Jan 18, 2023

Choose a reason for hiding this comment

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

This comment was stale as we now don't even use isDebugBuild anymore in the SDKs. Hence we can permit the default mode of tree shaking again.

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

I think this is a good change overall! Let's do it. This is not considered public API, and unlikely to affect anybody.

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.

Replay module: Cannot find module './node_modules/rrweb/es/rrweb/packages/rrweb/src/entries/all.js'
2 participants