Skip to content
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

Move npm module to esm and drop node < 20 #224

Open
polRk opened this issue May 15, 2024 · 6 comments
Open

Move npm module to esm and drop node < 20 #224

polRk opened this issue May 15, 2024 · 6 comments

Comments

@polRk
Copy link

polRk commented May 15, 2024

No description provided.

@polRk polRk changed the title Move to npm module esm and drop node < 20 Move npm module to esm and drop node < 20 May 15, 2024
@bestbeforetoday
Copy link
Member

Node 18 is still a supported LTS release for another year. We should definitely not drop support for it before it reaches end-of-life.

@bestbeforetoday
Copy link
Member

Provided it doesn't cause any compatibility issues for existing Node users, ensuring the @hyperledger/fabric-protos package is an ES module rather than CommonJS sounds pretty reasonable to me. I'm not sure how well the protobuf compiler output lends itself to being exposed as an ES module directly or if it relies on CommonJS import/export semantics. Maybe a bundler could be used to achieve the desired result?

@polRk
Copy link
Author

polRk commented May 16, 2024

Node 18 is still a supported LTS release for another year. We should definitely not drop support for it before it reaches end-of-life.

But now sdk support node 14...

@polRk
Copy link
Author

polRk commented May 16, 2024

Maybe a bundler could be used to achieve the desired result?

Yes, the current compiler is disgusting, you need to write a new solution here...

@bestbeforetoday
Copy link
Member

If you have a good idea for a better approach, you could submit a pull request?

@bestbeforetoday
Copy link
Member

Hmmm, digging a bit more into ESM and CommonJS module loading... it seems that ES modules can load CommonJS modules fine (with some minor caveats related to default exports), whereas ComonJS modules cannot (easily) load ES modules. Today fabric-protos is a CommonJS module so can be used by both CommonJS and ES modules. If we change fabric-protos to be a native ES module, it will break all existing CommonJS applications that depend on fabric-protos. That doesn't sound like a great change, although I'm happy to hear from anyone with better information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants