Closed cpojer closed 4 months ago
Oh gosh, thanks! I'll look into that and get this fixed. Thank you so much!
Should be fixed with 4.0.1! Thank you for reporting, the project is now building on esbuild. I would love to sound the death knell for CJS, but i think for compatibility reasons, I should hold off for a while.
Thank you for fixing it, 4.0.1 works 🙇♂️
Unfortunately, it seems like the ESM build is causing more trouble. When invoking rate
within a testfile in an ESM context it fails with this:
This is because sort-unwind
is exported in the same way as openskill 4.0.0 was, as type: "module"
but without the correct ESM pieces so it cannot be imported.
Fixing
Okay, let's try this again with 4.0.2
Tests seem to work out... https://gist.github.com/philihp/bd7ed8daa7871d1922a8027e0540db90
Seems to works now! Thank you so much 🙇♂️
Hey @philihp,
I love that you are updating the project to the latest and most modern stuff. I'm using your package in Athena Crisis (open source, but the openskill usage is not open). However, it seems that 4.0.0 does not export anything correctly in order to work in an ESM only environment in Node.js. Here is a gist with a
package.json
and anindex.js
file: https://gist.github.com/cpojer/9ced8e205d55b2c363feb34ae90de7ecWhen you run
node index.js
, it will saySyntaxError: The requested module 'openskill/dist/rate.js' does not provide a default export
. The same is true for attempting toimport { rate } …
or other specifiers. Since you converted this module to ESM, I would suggest getting rid of all the Babel ESM to CJS conversions, and possibly just switching to esbuild for compilation. This will make the project work only with ESM, but it seems like that's what you are going for – and folks on older versions of Node can stick with openskill 3.If you are looking for inspiration on how to set up esbuild and TypeScript within a super tiny library that is 90% boilerplate, check out @nkzw-tech/histogram. Let me know if you need any help – or if I got something wrong here and I'm doing something wrong when using openskill 4.