NotionX / react-notion-x

Fast and accurate React renderer for Notion. TS batteries included. ⚡️

Home Page:https://react-notion-x-demo.transitivebullsh.it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reintroduce CommonJS to make it easier to use the library

MartinXPN opened this issue · comments

Seems like this library used to support CommonJS but switched to ESM a while ago.
It would be really great to reintroduce the CommonJS support.
It's super painful to migrate CommonJS projects to ESM especially if they are tested with jest and have many mocks of named exports. It becomes a huge refactoring effort.

As this library is used in other projects, it would make sense to make it as accessible as possible. The current ESM-only approach makes it impossible to use in CommonJS projects, while CommonJS libraries are mostly okay to use in ESM projects.

Would it be possible to bring back the CommonJS support?

@normdoow @transitive-bullshit do you have any thoughts on this?

I have no plans to add commonjs support; it is deprecated for all intents and purposes. Aside from being deprecated, it is a huge pain to deal with as a maintainer, but it's not too difficult to use esm from commonjs projects if you're forced to use a legacy commonjs approach.

The current ESM-only approach makes it impossible to use in CommonJS projects

This statement is false. While it may not "just work", there are workarounds for compat that place the burden of work on the consumers of the packages instead of on the maintainers.

For more details, see this excellent resource: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c