Aeolun / react-diff-viewer-continued

A simple and beautiful text diff viewer component made with Diff and React.
https://aeolun.github.io/react-diff-viewer-continued/
MIT License
113 stars 34 forks source link

Default import is not the default export when using ESM #40

Open joostdecock opened 7 months ago

joostdecock commented 7 months ago

I tried using this in a NextJS ESM project, and the default import is not the default export, rather the module object.

My workaround probably does a better job at explaining the problem:

import diffViewerModule from "react-diff-viewer-continued"
const DiffViewer = diffViewerModule.default

I know that getting typescript and ESM to play nice can be a real PITA, but would it be possible to provide a build for ESM? Esbuild can handle this, you could perhaps build lib/index.mjs and then put that in the module field in package.json.

Aeolun commented 4 months ago

@joostdecock I think the next build now has an ESM version. Can you let me know if that works for your purposes?