Skip to content

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

Open
@joostdecock

Description

@joostdecock

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions