-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Reverse monkey patch built in methods to support LWC #1509
Conversation
…rweb into @juice10/@rrweb/types
Turns out what we where doing by overwriting `public textContent: string | undefined` as a getter in a subclass is something that isn't allowed in typescript. Because we where using `// @ts-ignore` to hide this error our bundler chose to allow the overwrite. Vite choses to disallow the overwrite making all subclasses' `textContent` undefined. To mitigate this we're using an abstract class, which does allow sub classes to decide if they wan't to use getters or not.
This removes console from rrweb-all.js
something when wrong earlier when resolving merge conflicts, this should be correct
This feels incorrect to me (Justin Halsall), but some of the tests break without it so I'm restoring this to be closer to its original here: https://github.com/rrweb-io/rrweb/blame/cfd686d488a9b88dba6b6f8880b5e4375dd8062c/packages/rrweb-snapshot/src/snapshot.ts#L1011
I've asked a SO question here to see if there are any ideas on how we might achieve the goals of this PR with less invasive code changes: Could we add a new (optional) output target, which pulls in the added functions, and also includes a rollup plugin to find/replace all the needed property accesses? |
From SO, the first replier mentions https://www.npmjs.com/package/ts-patch |
…10/reverse-monkey-patch
I agree that it would be really nice if we could use some sort of general purpose solution to rewrite this out of the box. Currently we have a couple things that make this difficult:
|
…10/reverse-monkey-patch
…10/reverse-monkey-patch
I've just noticed that I've added code in Presumably I'll have to do some type checking to figure out whether to call |
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.
Great feature for recording LWS based websites!
LWC monkey patches a lot of built in methods.
This PR gets around that issue by pulling new references from a temporary iframe, which hasn't been monkey patched yet.