htmlparser2 icon indicating copy to clipboard operation
htmlparser2 copied to clipboard

Old Import statement of DomUtils

Open super-user-permission opened this issue 3 years ago • 2 comments

The old import statement of DomUtils in src/index.js breaks the compilation.

export * as DomUtils from "domutils";

Commenting this statement out seems to solve the problem.

Error:

ERROR in ./node_modules/html-to-react/node_modules/htmlparser2/lib/esm/index.js 59:9
Module parse failed: Unexpected token (59:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     return getFeed(parseDOM(feed, options));
| }
> export * as DomUtils from "domutils";
| // Old name for DomHandler
| export { DomHandler as DefaultHandler };
 @ ./node_modules/html-to-react/lib/parser.js 2:19-41
 @ ./node_modules/html-to-react/index.js
 @ ./.storybook/preview.js

Commenting out the export statement in node modules is not a solution but a temporary work-around to get the code running.

super-user-permission avatar Jul 17 '22 11:07 super-user-permission

I'm getting the same error. Do you have any hints on how to go around this?

Selerski avatar Jul 28 '22 14:07 Selerski

Well, not really. I was using the html-to-react library which was using this library as a dependency. I'm using a different library html-react-parser, this does the same thing and works fine.

Also as I mentioned earlier there is a temporary solution to run the code, comment the export statement in node_modules.

super-user-permission avatar Jul 28 '22 14:07 super-user-permission

Duplicate of https://github.com/fb55/htmlparser2/issues/1237. See https://github.com/fb55/htmlparser2/issues/1237#issuecomment-1182522861 for some suggestions for how to work around this.

fb55 avatar Aug 05 '22 14:08 fb55