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

"jsdiff" methods Tree Shaking removing #94

Open
claviustales opened this issue Aug 12, 2020 · 0 comments
Open

"jsdiff" methods Tree Shaking removing #94

claviustales opened this issue Aug 12, 2020 · 0 comments

Comments

@claviustales
Copy link

claviustales commented Aug 12, 2020

We use Tree Shaking in our project. It removes dead-code.

It is removing "diffChars" method from "jsdiff" lib.

We are doing the following workaround:

- import DiffViewer from "react-diff-viewer";
+ import DiffViewer, { DiffMethod } from "react-diff-viewer";
+ import { diffChars } from "diff";

  <DiffViewer
    oldValue={props.oldValue}
    newValue={props.newValue}
+   compareMethod={diffChars.name as DiffMethod.CHARS}
  />

We suggest to improve typing on following code to prevent Tree Shaking:

const jsDiff: { [key: string]: any } = diff;

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

No branches or pull requests

1 participant