node:internal/modules/cjs/loader:1041
throw new ERR_REQUIRE_ESM(filename, true);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/triallax/Desktop/insect/node_modules/decimal.js/decimal.mjs not supported.
Instead change the require of /home/triallax/Desktop/insect/node_modules/decimal.js/decimal.mjs to a dynamic import() which is available in all CommonJS modules.
at /home/triallax/Desktop/insect/index.cjs:4:42947
at Object.<anonymous> (/home/triallax/Desktop/insect/index.cjs:15:331) {
code: 'ERR_REQUIRE_ESM'
}
This PR also adds a step in the CI that runs ./index.cjs, to ensure a situation like this doesn't happen again in the future.
Some change in decimal.js 10.4.0 (almost certainly https://github.com/MikeMcl/decimal.js/commit/0bc3fdbdaa5e8d2f58087a8fceb200da28fa6d5c) broke running
index.cjs
. Previously, the CommonJSdecimal.js
module was imported, but with decimal.js 10.4.0decimal.mjs
is instead imported, thus the following error when runningindex.cjs
:This PR also adds a step in the CI that runs
./index.cjs
, to ensure a situation like this doesn't happen again in the future.