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

Fix problem of Colleagues from Fujitsu #111

Closed
appetrosyan opened this issue Jul 26, 2022 · 2 comments · Fixed by #112
Closed

Fix problem of Colleagues from Fujitsu #111

appetrosyan opened this issue Jul 26, 2022 · 2 comments · Fixed by #112
Labels

Comments

@appetrosyan
Copy link
Contributor

appetrosyan commented Jul 26, 2022

Our colleagues from Fujitsu have asked us to provide assistance in setting up their Iroha interoperability. Their work can be found here.

https://github.com/outSH/iroha2_check

@0x009922, @antyas mentioned that you are working on something similar.

@0x009922 0x009922 added the iroha2 label Aug 2, 2022
@0x009922 0x009922 linked a pull request Aug 2, 2022 that will close this issue
@0x009922
Copy link
Contributor

This issue is partially solved with the latest packages publish.

In CJS mode it works just fine. That means, in iroha2_check you could run the following:

tsc
node .

tsc will build dist/index.js file, and node . will run it in CJS mode.

However, pure ESM mode is not working yet. That means, the following will fail:

tsc --module esnext
mv dist/index.js dist/index.mjs
node dist/index.mjs

The error:

SyntaxError: Named export 'Enum' not found. The requested module '@scale-codec/core' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@scale-codec/core';

I am in the process of fixing scale-codec-js-library and its dependencies. They all should use .mjs as well.

@0x009922
Copy link
Contributor

0x009922 commented Aug 31, 2022

Finally, JS SDK works in ESM with the following packages versions:

{
    "@iroha2/client": "^2.0.2",
    "@iroha2/crypto-core": "^0.1.1",
    "@iroha2/crypto-target-node": "^0.4.0",
    "@iroha2/data-model": "^2.0.2"
}

Now it is possible to run the following without getting ESM/CJS errors:

rm -r dist
pnpm tsc
mv dist/index.js dist/index.mjs
node dist/index.mjs

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

Successfully merging a pull request may close this issue.

2 participants