You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is this feature about?
Since gamedig is a library, it would be more interesting to allow users who use it to choose within the scope of their projects whether to use ESModules or CommonJS.
Additional context/references
Many people are having problems using version 5.0 because their projects use CommonJS require("gamedig"). Using a bundler like esbuild, it is possible to maintain the same code base and support both module methods.
I did some testing with esbuild, where the library is transpiled to ESModule and CommonJS with a script.
Just keep in mind that this adds an extra step to the lib, requiring the build script to be run before publishing, for example. But at the same time it removes the obligation to use ESModules.
The text was updated successfully, but these errors were encountered:
I came across this issue and took me a while to convert it as I am a nodejs newbie. But got there in the end. But this is a code breaking thing for projects that already use gamedig. If it is possible to upgrade to 5 without having to refactor that would be idea.
Simply rewrite the projects from CommonJS to ESModules. Has many advantages and is now not that difficult. There will also be more and more ESModules in the future.
Simply rewrite the projects from CommonJS to ESModules. Has many advantages and is now not that difficult. There will also be more and more ESModules in the future.
It indeed is not that difficult and yeah, it will be more and more in the future, but not all projects are that easy to rewrite (you wouldn't move to esm if you got a huge cjs project) and as @dgibbs64 said, it's quite confusing for beginners and it is a breaking change that we could easily fix for pretty much nothing.
What is this feature about?
Since gamedig is a library, it would be more interesting to allow users who use it to choose within the scope of their projects whether to use ESModules or CommonJS.
Additional context/references
Many people are having problems using version 5.0 because their projects use CommonJS
require("gamedig")
. Using a bundler like esbuild, it is possible to maintain the same code base and support both module methods.I did some testing with esbuild, where the library is transpiled to ESModule and CommonJS with a script.
Just keep in mind that this adds an extra step to the lib, requiring the build script to be run before publishing, for example. But at the same time it removes the obligation to use ESModules.
The text was updated successfully, but these errors were encountered: