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]: Error while importing the web version in webpack #2255

Open
1 task done
Druelik opened this issue Jul 3, 2024 · 1 comment
Open
1 task done

[Bug]: Error while importing the web version in webpack #2255

Druelik opened this issue Jul 3, 2024 · 1 comment

Comments

@Druelik
Copy link

Druelik commented Jul 3, 2024

Issue description

After updating to the latest version 1.1.3 and following the examples. Webpack reports error while importing the wasm library.

OutputDiscriminator seems to be undefined. At least it is that, what webpack reports back as error.

Returning to version 1.1.2 fixes the Problem.

Version

@iota/sdk-wasm : 1.1.3

Expected behaviour

Import should work without errors

Actual behaviour

Webpack errors on the import.

Can the issue reliably be reproduced?

Yes

Steps to reproduce the issue

  1. Follow the example, with webpack
  2. Import the lib
  3. See the crash in the browser.

Errors

Log:

Uncaught TypeError: _output__WEBPACK_IMPORTED_MODULE_2__ is undefined
    OutputDiscriminator index.js:21
    OutputResponse output-response.ts:20
    <anonymous> output-response.ts:23
    node_modules chunk-vendors.js:867
  

Screenshot:
image

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 Jul 3, 2024
@sdellava
Copy link

I've a very similar issue.

This is the simple code I've added in a EXPO project:

import { IotaIdentityClient, Resolver } from '@iota/identity-wasm/web';
import { Client } from '@iota/sdk-wasm/web';

export async function resolveDID(did: string): Promise<string> {
  
  const nodeUrl = 'https://api.testnet.shimmer.network/';
  const client = new Client({
    primaryNode: nodeUrl,
    localPow: true,
  });

  const didClient = new IotaIdentityClient(client);


  const resolver = new Resolver({  client: didClient  });
  try {
    const resolvedDocument = await resolver.resolve(did);
    return JSON.stringify(resolvedDocument, null, 2);
  } catch (error) {
    throw new Error(Failed to resolve DID: ${error});
  }
}

And this is the result:

lib installation:

yarn add @iota/sdk-wasm
yarn add v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @rneui/[email protected]" has unmet peer dependency "react-native-vector-icons@>7.0.0".
warning "expo-splash-screen > @expo/[email protected]" has unmet peer dependency "expo-modules-autolinking@>=0.8.1".
warning "react-native > react-native-codegen > [email protected]" has unmet peer dependency "@babel/preset-env@^7.1.6".
warning "jest-expo > [email protected]" has unmet peer dependency "jest@^27.0.0 ^28.0.0 ^29.0.0".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
warning Workspaces can only be enabled in private projects.
success Saved 1 new dependency.
info Direct dependencies
└─ @iota/[email protected]
info All dependencies
└─ @iota/[email protected]
Done in 11.04s.

test:
PS C:.....> npx expo start
Starting project at C:.....
Some dependencies are incompatible with the installed expo version:
@expo/[email protected] - expected version: ~8.0.0
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install @expo/config@~8.0.0
Error: Cannot find module '@iota/sdk-wasm/web'

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

No branches or pull requests

2 participants