tscanlin / tocbot

Build a table of contents from headings in an HTML document.
MIT License
1.37k stars 114 forks source link

Incorrect entry point for cjs #350

Open Duby-biu opened 5 days ago

Duby-biu commented 5 days ago

Issue description

The package.json file specifies "type": "module", but entry point uses commonjs (require Syntax). refer to: https://nodejs.org/api/packages.html#type This causes errors when you try to test with vitest. You will get "require() of ES Module ... not supported."

Expected Behavior

The package.json should state "type": "commonjs" or change ./dist/tocbot.js file to ./dist/tocbot.cjs

Environment

Library version: v4.28.2

jcwillox commented 5 days ago

Yes still seems to be an issue with 4.28.2, and is related to https://github.com/tscanlin/tocbot/issues/340. I've just had to downgrade to 4.27.16 again.