cashify icon indicating copy to clipboard operation
cashify copied to clipboard

Cashify 3.0+ Breaking Changes - Node.js v17.2.0 ERR_REQUIRE_ESM

Open talkquazi opened this issue 3 years ago • 3 comments

Breaking changes to version 3.0+ of cashify has the following breaking changes that you did not mention in your Readme.

`const { Cashify } = require('cashify'); ^

Error [ERR_REQUIRE_ESM]: require() of ES Module .\node_modules\cashify\dist\index.js from .\lib\currency.js not supported. Instead change the require of index.js in .\lib\currency.js to a dynamic import() which is available in all CommonJS modules. at Object. (.\lib\currency.js:1:21) at Object. (.\lib\amazonProfit.js:32:18) at .\server.js:64:26 at Object.init (.\lib\ssl.js:65:7) at .\server.js:50:7 at .\node_modules\entourage\lib\entourage.js:126:9 at wrapper (.\node_modules\async\dist\async.js:271:20) at iteratorCallback (.\node_modules\async\dist\async.js:501:17) at .\node_modules\async\dist\async.js:327:20 at .\node_modules\entourage\lib\entourage.js:117:11 at .\node_modules\async\dist\async.js:2557:44 at eachOfArrayLike (.\node_modules\async\dist\async.js:506:13) at eachOf (.\node_modules\async\dist\async.js:626:16) at awaitable (.\node_modules\async\dist\async.js:211:32) at Object.eachLimit (.\node_modules\async\dist\async.js:2660:16) at Object.awaitable (.\node_modules\async\dist\async.js:211:32) at .\node_modules\entourage\lib\entourage.js:100:11 at f (.\node_modules\once\once.js:25:25) at Glob. (.\node_modules\entourage\node_modules\glob\glob.js:148:7) at Glob.emit (node:events:390:28) at Glob._finish (.\node_modules\entourage\node_modules\glob\glob.js:194:8) at done (.\node_modules\entourage\node_modules\glob\glob.js:179:14) at Glob._processSimple2 (.\node_modules\entourage\node_modules\glob\glob.js:703:3) at .\node_modules\entourage\node_modules\glob\glob.js:673:10 at Glob.stat2 (.\node_modules\entourage\node_modules\glob\glob.js:786:10) at lstatcb (.\node_modules\entourage\node_modules\glob\glob.js:761:12) at RES (.\node_modules\inflight\inflight.js:31:16) at f (.\node_modules\once\once.js:25:25) at FSReqCallback.oncomplete (node:fs:199:5) { code: 'ERR_REQUIRE_ESM' }

Node.js v17.2.0`

talkquazi avatar Dec 10 '21 21:12 talkquazi

I mentioned the transition to ESM both in the changelog and README.

xxczaki avatar Dec 11 '21 15:12 xxczaki

The standard thing to do is to put a header near the top of your README that says BREAKING CHANGES in bold and explain the change there.

Furthermore, your changes break the module in NodeJS. Out of thousands of modules that I have used in my years of using NodeJS this is the first module to completely break the loading mechanism using require. This is also the first module to not specifically announce BREAKING CHANGES at the top of the README.

Your changes also makes this section of your README inaccurate https://github.com/xxczaki/cashify#migrating-from-moneyjs aka a lie.

Suggestion: Make require work by allowing an async module loader so import is not forced as majority of people using Node are still using require and do not want to asynchronously setup a workaround to require a module.

PS: Looking at your download statistics based on version it is pretty clear you have disenfranchised many people with these breaking changes.

https://www.npmjs.com/package/cashify <-- click versions tab at the top `Version Downloads (Last 7 Days)

Published

3.0.1 30

20 hours ago

3.0.0 102

6 days ago

2.5.0 2,790

a year ago

2.4.4 16

a year ago

2.4.3 239

a year ago`

talkquazi avatar Dec 11 '21 15:12 talkquazi

@talkquazi I am maintaining an ES2017 fork of this package at https://www.npmjs.com/package/cashify-es2017 , which means it can be used as any other package.

d2xdt2 avatar Sep 15 '22 14:09 d2xdt2