aduth / rememo

Memoized selectors for Redux and other immutable object derivation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CommonJS export does not work in 4.0.0

anomiex opened this issue · comments

Despite claiming to offer a CommonJS ("require") export, said export does not actually work:

Error [ERR_REQUIRE_ESM]: require() of ES Module /tmp/x/xx/node_modules/rememo/rememo.js from /tmp/x/xx/[eval] not supported.
rememo.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename rememo.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /tmp/x/xx/node_modules/rememo/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

It looks like this will already be fixed by 1af1b84, but a release is needed.

Thanks for raising this. Admittedly I can't recall the original motivation behind the commit 1af1b84 you mentioned, but I can confirm that it does seem to resolve this issue. I published a new version with the latest master commits in v4.0.1 . Let me know if you still have issues after upgrading.

4.0.1 is working for us. Thanks for the quick response!