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

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

Open
joostdecock opened this issue Jan 22, 2024 · 1 comment
Open

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

joostdecock opened this issue Jan 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@joostdecock
Copy link

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
Copy link
Owner

Aeolun commented Apr 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants