Skip to content

Can't import the named export 'formatDOM' from non EcmaScript module (only default export is available) #337

@aghArdeshir

Description

@aghArdeshir

Expected Behavior

Actual Behavior

I'm receiving this error when I simply try to use the library.

error - /app/node_modules/html-dom-parser/lib/client/html-to-dom.mjs
Can't import the named export 'formatDOM' from non EcmaScript module (only default export is available)

Steps to Reproduce

I am actually using html-react-parser which is using html-dom-parser. But as I checked in node_modules, I have the latest version of both libraries:

"html-dom-parser": "^3.1.1",
"html-react-parser": "^3.0.3",

which means it includes this fix as well: #335
But I am still having this issue.

Reproducible Demo

This is actually simply how I am using this library:

import parse from 'html-react-parser';

parse(someString);

But this problem is happening inside NextJS.

Environment

  • Version: 3.1.1
  • Platform: I am using NextJs, that may be causing the issue as well!
  • Browser: Not Applicable, it happens in server

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions