Skip to content
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

ESM build attempts to import CJS build modules from 'entities' #1782

Open
barneycarroll opened this issue Mar 13, 2024 · 2 comments
Open

ESM build attempts to import CJS build modules from 'entities' #1782

barneycarroll opened this issue Mar 13, 2024 · 2 comments

Comments

@barneycarroll
Copy link

Parser.ts hardcodes an import identifier pointing to the CJS build of entities:

import { fromCodePoint } from "entities/lib/decode.js";

This breaks pure ESM parsing of the ESM build. I'm not sure what a conventional solution would look like, but assume there ought to be an 'abstract' identifier path which would resolve by parsing package.json depending on environment?

@maxgurewitz
Copy link

@barneycarroll were you able to address this?

@barneycarroll
Copy link
Author

@maxgurewitz the closed source project I was using that depended on htmlparser2 (via linkedom) uses a custom JavaScript parser, so the issue was worked around there. I know various open source bundlers and runtime hacks allow inter-operating CJS & ESM, but I couldn’t recommend a generic solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants