Skip to content

Conversation

@cardoso
Copy link
Contributor

@cardoso cardoso commented Feb 20, 2025

Closes #1296

@cardoso
Copy link
Contributor Author

cardoso commented Feb 20, 2025

Tests are passing locally, however I need to take a second look into build:cjs. I don't use commonjs, but not looking to break anything unless needed. It's probably a simple tweak.

@43081j
Copy link
Collaborator

43081j commented Feb 20, 2025

@fb55 @wooorm there's probably some way we can make this build work but it'll likely involve changing how we produce the CJS output (not as simple as changing some flags, rather introducing something like tsup)

assuming im not missing something and that is the case, what do you two think about a new major which is ESM-only?

now that require(esm) is in all but one of node LTS versions (it isn't in 18 but that leaves LTS in april). maybe let's just publish a new major and people can gradually move to it as 18.x goes away?

@cardoso
Copy link
Contributor Author

cardoso commented Feb 20, 2025

@43081j for what it's worth, I'm super in favor of a new esm-only major version.

@wooorm
Copy link
Collaborator

wooorm commented Feb 21, 2025

👍 to esm only

@cardoso
Copy link
Contributor Author

cardoso commented Feb 24, 2025

Technically the error we get for build:cjs (TS7016) is not emit-related, so I reverted the changes to build:cjs script and added --noCheck.

@fb55 are you able to confirm whether this change is non-breaking for Cheerio?

@cardoso cardoso mentioned this pull request Mar 7, 2025
@fb55
Copy link
Collaborator

fb55 commented Mar 7, 2025

@fb55 are you able to confirm whether this change is non-breaking for Cheerio?

Yup, non-breaking for Cheerio.

@cardoso cardoso requested a review from 43081j March 7, 2025 18:02
@fb55 fb55 merged commit c5f8690 into inikulin:master Mar 12, 2025
7 checks passed
@fb55
Copy link
Collaborator

fb55 commented Mar 12, 2025

Thanks @cardoso!

@cardoso cardoso deleted the entities6 branch March 12, 2025 19:02
@danshome
Copy link

@cardoso, We recently started getting this issue in our build. Is this related? If so, what do we need to do to address it?

[INFO] node_modules/parse5/dist/tokenizer/index.d.ts:3:31 - error TS7016: Could not find a declaration file for module 'entities/decode'. '/dev/workspace/releases/29.0.x/my-apps/node_modules/parse5/node_modules/entities/decode.js' implicitly has an 'any' type.
[INFO] Try npm i --save-dev @types/entities if it exists or add a new declaration (.d.ts) file containing declare module 'entities/decode';
[INFO]
[INFO] 3 import { EntityDecoder } from 'entities/decode';

I tried npm i—-save-dev @types/entities, but it didn't resolve it. I'm just trying to understand what changed that is causing this. Based on the message, it seems more like there is an issue in the decode.js, but I haven't had a chance to look at that code yet.

@43081j
Copy link
Collaborator

43081j commented Apr 28, 2025

@danshome this is because entities relies on node module resolution in 6.x, since it ships a dual package

if you set your tsconfig's moduleResolution to node16, it should work

the types do exist, its just that the mode your typescript is running in doesn't read exports in the package.json

@fb55 up to you if you want people to have to do this, or update entities to be ESM only and export real paths (i.e. set decode.js to point at decode.js, the actual on-disk path).

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

Successfully merging this pull request may close these issues.

error TS2305: Module '"entities/lib/decode.js"' has no exported member 'EntityDecoder'.

5 participants