fb55 / htmlparser2

The fast & forgiving HTML and XML parser
https://feedic.com/htmlparser2
MIT License
4.46k stars 377 forks source link

Does not work in a ESM project #1929

Open kibertoad opened 1 month ago

kibertoad commented 1 month ago

When trying to run a service with the following TSConfig:

        "module": "ESNext",
        "moduleResolution": "node",

an error is thrown:

import { Parser as T } from "../../../../node_modules/htmlparser2/lib/esm/Parser.js";
         ^^^^^^
SyntaxError: Named export 'Parser' not found. The requested module '../../../../node_modules/htmlparser2/lib/esm/Parser.js' is a CommonJS module, which may not support all module.exports as named exports.
kibertoad commented 1 month ago

Might be related to https://github.com/fb55/htmlparser2/issues/1782