react-diff-viewer
react-diff-viewer copied to clipboard
"jsdiff" methods Tree Shaking removing
trafficstars
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:
https://github.com/praneshr/react-diff-viewer/blob/9ac4ba90643f0695179aebab6ce6311adbad0f11/src/compute-lines.ts#L3