-
Notifications
You must be signed in to change notification settings - Fork 13
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
any plan to publish es module ? #86
Comments
I was actually banging my head against the wall on a different lib today wrt esmodules. |
Yes, you could compile to both and set the correct export The issue I have is with cloudflare worker vitest integration. I have this error : cloudflare/workers-sdk#5367 but with tlock-js / drand-client
|
@CluEleSsUK I made a reproduction repo : https://github.com/bug-reproduction/tlock-js-cf-worker-vitest to see the bug
but it works when running the worker itself:
|
The same repo work with these modif: drand-client: generate both cjs and esm: #87 tlock-js: generate both cjs and esm: drand/tlock-js#46 |
So the 2 PR works quite well. The only thing I noticed in that when using the es module in node, it output a performance warning because of not having {"type":" module"} Ideally the project would have "type": "module" in package.json and tsconfig set to have "moduleResolution": "NodeNext" but that cause issue with your code (you also need to use .js extension for relative import) The best in the future might be generate 2 packages: one esm and one cjs from the same code But for now these 2 PR are probably better than what is there. |
After testing in more scenarios, the solution proposed in my PR is still problematic So I think the best way forward is to update the code to modern output and have a cjs build too |
Getting issues with modern tooling that expect es modules
Not sure yet what is the exact issue but feel like there is no reason why drand-client could not publish es-module, which brings further davantage like proper dead code elimination, etc...
The text was updated successfully, but these errors were encountered: