fb55 / htmlparser2

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

Does not work in a ESM project #1929

Open kibertoad opened 3 weeks ago

kibertoad commented 3 weeks 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 week ago

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