yiwen-ai / xid-ts

xid is a globally unique id generator thought for the web. A Typescript port of https://github.com/rs/xid.
MIT License
24 stars 2 forks source link

Error [ERR_REQUIRE_ESM]: require() of ES Module #10

Closed shinjonathan closed 2 months ago

shinjonathan commented 5 months ago

Running into the following error when attempting to import this project into a cjs project.

Error [ERR_REQUIRE_ESM]: require() of ES Module /.../node_modules/xid-ts/dist/index.js from /.../target.ts not supported.
Instead change the require of index.js in /.../target.ts to a dynamic import() which is available in all CommonJS modules.

Does anyone have a workaround for setting up this dynamic import?

voronovmaksim commented 2 months ago

same issue

zensh commented 2 months ago

cjs module is exported @v1.1.3, please try it again.