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

[Bug]: WASM Bindings don't work with ESM project structure #2218

Open
1 task done
coodos opened this issue Apr 12, 2024 · 2 comments
Open
1 task done

[Bug]: WASM Bindings don't work with ESM project structure #2218

coodos opened this issue Apr 12, 2024 · 2 comments
Assignees

Comments

@coodos
Copy link

coodos commented Apr 12, 2024

Issue description

WASM bindings do not work with ESM

Version

v0.1.3

Expected behaviour

bindings work

Actual behaviour

since in package.json just files are exported in an ESM project you can't consume from directories like node and web

Can the issue reliably be reproduced?

Yes

Steps to reproduce the issue

  1. create esm project
  2. try to import from /node or /web

Errors

ModuleNotFound

Duplicate declaration

  • I have searched the issues tracker this issue and there is none
@github-project-automation github-project-automation bot moved this to Product Backlog in iota-sdk Apr 12, 2024
@coodos
Copy link
Author

coodos commented Apr 12, 2024

can be fixed pretty simply with adding explicit exports in package.json

 "exports": {
        "./node": {
            "require": "./node/lib/index.js",
            "import": {
                "types": "./node/lib/index.d.js",
                "default": "./node/lib/index.js"
            },
            "default": "./node/lib/index.js"
        }
    }

@Thoralf-M
Copy link
Member

@coodos your example is missing the web export which results in Missing "./web" specifier in "@iota/sdk-wasm" package for packages that want to use it

For me I can use import { Client } from '@iota/sdk-wasm/node/lib/index.js'; in an ESM project

@thibault-martinez thibault-martinez moved this from Product Backlog to Sprint Backlog in iota-sdk Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Sprint Backlog
Development

No branches or pull requests

3 participants