sergeyzwezdin / hexo-related-posts

Hexo plugin that generates related posts list with TF/IDF algorithm
https://hexo.io/
MIT License
21 stars 8 forks source link

Upgrade to ESM Specification for Compatibility with Chalk v5 and Modern Package Managers #23

Open sghuang19 opened 3 months ago

sghuang19 commented 3 months ago

We should consider upgrading this plugin to the ESM specification.

With chalk@5 now available and utilizing ESM, it’s no longer possible to import it using require. Sticking to chalk@4 has caused issues with resolving dependencies when using package managers like yarn and pnpm, leading to a frustrating experience for users who prefer these tools over npm.

Given that Hexo has already adopted the ESM spec, it might be the right time to transition this plugin as well. The refactoring should be relatively straightforward, primarily involving changes to the import and export syntax.

I’m happy to assist with this migration if the community agrees. This upgrade would enhance compatibility and streamline the development experience for everyone using this plugin.

sghuang19 commented 3 months ago

Just realized that we don't have to switch all the import and export to ESM. Only need to adjust the import for chalk.