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
Conversation
size-limit report 📦
|
// * build/npm/esm/node_modules/rrweb/... | ||
// * build/npm/esm/packages/replay/... | ||
preserveModulesRoot: path.join(process.cwd(), 'src'), | ||
preserveModules: false, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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