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): Rename node_modules
directory inside build output directories
#6757
Conversation
We should check if this influences our source maps in some way. Looking at the packages' code it does some non-trivial stuff. If, for some reason this change has issues we could try the following: Bundle the rrweb dependency in a previous rollup step with |
Afaik, it uses MagicString to adjust source maps There is another alternative to this: We were just discussing releasing rrweb from our getsentry/rrweb fork which would make patching the actual rrweb package unnecessary. Hence we could stop pulling in the files which would also remove said |
size-limit report 📦
|
Lol funny observation: rrweb also uses this very plugin to rename vendored dependencies: https://github.com/getsentry/rrweb/blob/f1d2080a649875f054238cb54f935f1a2b36d5c2/packages/rrweb/rollup.config.js#L177 |
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 great short term solution. Mid term we should explore publishing our fork, that would streamline this - but for now, seems like an easy fix!
I also like the idea of publishing the fork! |
@lforst your concern turned out to be valid: With this plugin, the generated source maps seem to get majorly destroyed: The maps dont contain any |
If we could just disable sourcemaps here, I think that would be fine! |
I don't care too much but this will break downstream source maps of our SDK/Replay. |
Closing, as it messes up source maps :( |
As reported in #6690, apparently some bundlers and plugins seem to have problems when JS modules import from other modules under a
node_modules
directory. After we decided to vendor rrweb to patch it, we have such a directory inside ourbuild/npm/(esm|cjs)/node_modules/rrweb/...
. This PR adds the rollup-plugin-rename-node-modules plugin which takes care of renaming such paths during the rollup build.With this change, rrweb can now be found under
build/npm/(esm|cjs)/ext/rrweb/...
. Let's see if this fixes the bug reports.Tested this change locally with a plain-js test app (npm package as well as minified cdn bundles).
Possibly fixes #6690