-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with loading as ECMAScript module (ESM) #149
Comments
I am having this error as well |
I have no idea about this issue, but you can use: import parse from 'node-html-parser'; to avoid this. |
@taoqf Sadly it does not work while using from ES module... Exports from CJS modules work in ES module, but default isn't working like it used to do in CJS. import parse from "node-html-parser";
console.log(parse);
const test = parse('<div>test</div>');
console.log(test);
|
Only way to do it without the #150 would be like below: import NodeHTMLParser from "node-html-parser";
// @ts-ignore
const { parse } = NodeHTMLParser;
console.log(parse);
const test = parse('<div>test</div>');
console.log(test);
but please note, it does not work properly with Typescript (hence the Even with the error suppression, the types does not working anymore (everything stays |
I will be addressing this by adding a workable ESM output. Follow the issue below for updates. Closing this as duplicate Main Issue: |
Problem
I wanted to use the package in project that is using the modules (ECMAScript Modules / ESM / `"type": "module").
Sadly I can't:
Despite the building process includes outputting
esm
files, they are not recognized (by anything).Environment
module version:
4.1.4
node version:
16.9.0
npm version:
7.21.1
The text was updated successfully, but these errors were encountered: