nodejs-paddle-sdk icon indicating copy to clipboard operation
nodejs-paddle-sdk copied to clipboard

ERR_REQUIRE_ESM

Open JonathanAmdahl opened this issue 1 year ago • 3 comments

Error [ERR_REQUIRE_ESM]: require() of ES Module /@[email protected]/node_modules/@invertase/node-paddle-sdk/dist/node-paddle-sdk.cjs.js
node-paddle-sdk.cjs.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 node-paddle-sdk.cjs.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 /node_modules/.pnpm/@[email protected]/node_modules/@invertase/node-paddle-sdk/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

I was able to temporarily fix this by switching nodejs-paddle-sdk's module to commonjs

JonathanAmdahl avatar May 13 '23 18:05 JonathanAmdahl