3 ms·
if you use a package manager like `pnpm` you can use the `.pnpmfile.cjs`[0] to intercept packages and add `"type": "commonjs"` to the package.json. This tells
by no_wizard 3y ago
if you use a package manager like `pnpm` you can use the `.pnpmfile.cjs`[0] to intercept packages and add `"type": "commonjs"` to the package.json.
This tells node that it needs to load it as a CommonJS package and should work fine with ESM.
There's also creating a require function from `node:module` package[1]
[0]: https://pnpm.io/pnpmfile https://pnpm.io/pnpmfile
[1]: https://nodejs.org/dist/latest-v18.x/docs/api/module.html#modulecreaterequirefilename https://nodejs.org/dist/latest-v18.x/docs/api/module.html#mo...