dfahlander / typeson-registry

The type registry for typeson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CommonJS require error

bananatost opened this issue · comments

Hello! We're getting the below error when attempting to import the package in our commonjs node project. I noticed there was an issue in the typeson package that required a similar fix. Thanks in advanced!

Error [ERR_REQUIRE_ESM]: require() of ES Module ./node_modules/typeson-registry/dist/index.umd.min.js not supported. index.umd.min.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 index.umd.min.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/typeson-registry/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

Am having some health issues so unfortunately, I may not get to this in a very timely fashion.

Recovered enough to work on this. Let me know if it works for you now. Released as v8.0.0.

@brettz9, you absolute rockstar of a human. You really didn't have to hop on this so soon or at all especially with your health situation. Your changes and subsequent release did the trick. Thank you so much for the patch, and wishing you a speedy recovery and brighter days ahead!

So kind of you to say, thank you so much, but it really wasn't too hard, and I really didn't want something like that hanging on blocking folks from using the library. Thanks for testing the update, and best wishes to you!