-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CommonJS import does not work with moduleResolution: "node" #227
Comments
I have updated the example. See geckosio/geckos-v2-cjs-example@e788c15 |
@yandeu Thank you, I've pulled that change into my fork but it does not appear to have any effect. Did you experience the ERR_REQUIRE_ESM before the change, but not after? |
I'm not sure. I never use CJS. But the example worked after updating. Did you also do |
This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This issue was closed because it has been stalled for 10 days with no activity. |
What do we do if we are using the import in a file that exports a class? Is there a reason commonjs can't just be supported? |
I am working on supporting cjs. |
Ah ok cool. I saw his issue closed so I just wanted to check in. If it's useful, I am trying to get it geckos.io working with nengi (https://github.com/timetocode/nengi). I think they would be a really good pairing, as by default nengi uses websockets rather than UDP. From my perspective nengi was written with deterministic movement in mind - but naturally I am interested in networked physics. A big part of making that successful based on my research (gaffer on games) is a UDP approach to data transfer. If I can be of assistance with testing please let me know. |
geckos v2.3.2-dev.0 does now fully support cjs. |
Awesome! Thanks @yandeu ! |
Related to #114
Trying to use the library in a ts-node project. The project needs to use
{ "moduleResolution": "node" }
in its tsconfig.json, as many modules (socket.io specfically) require it.Example: https://github.com/jackbonaguro/geckos-v2-cjs-example
While geckos.io can be imported in Common.js, changing this line in tsconfig.json breaks the import with the same ERR_REQUIRE_ESM as if it were imported as an ESM module.
The text was updated successfully, but these errors were encountered: