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

Can not resolve dependency './rsa_lib_bg' - Issue with using Parcel #13

Open
harunoz opened this issue Dec 4, 2020 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@harunoz
Copy link

harunoz commented Dec 4, 2020

Hello I am trying to use wasm-rsa on my web application. I am using parcel to use this module.

app.js

import RSASetup from 'wasm-rsa'
 
// First peer
const rsaPeerOne = RSASetup()
const privateKeys = rsaPeerOne.generateRSAPrivate(1024)
const signature = rsaPeerOne.signMessage('Hello')
 
// Second peer
const rsaPeerTwo = RSASetup()
const publicKeys = rsaPeerTwo.createRSAPublic(privateN, privateE)
const verify = rsaPeerTwo.verify('Hello', signature)
 
if (verify) {
  console.log('verify success')
}
else{
    console.log('a');
}

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Parcel Demo 01</title>
</head>
<body>
    <div id="message"></div>
    <script src="./app.js" type="text/javascript" ></script>
    <button id="but">Click</button>
</body>


</html>

Problem

When I run the parcel index.html command I am getting following error:

Server running at http://localhost:63418 - configured port 1234 could not be used.
🚨  /Users/harunoz/Desktop/testRsa/node_modules/wasm-rsa/wasm/browser/rsa_lib.js:2:22: Cannot resolve dependency './rsa_lib_bg' at '/Users/harunoz/Desktop/testRsa/node_modules/wasm-rsa/wasm/browser/rsa_lib_bg'
  1 | /* tslint:disable */
> 2 | import * as wasm from './rsa_lib_bg';
    |                      ^
  3 | 
  4 | let cachedTextEncoder = new TextEncoder('utf-8');

How can I build this with parcel?

Thanks for your help!

@harunoz harunoz changed the title Can not resolve dependency - Issue with Parcel Can not resolve dependency './rsa_lib_bg' - Issue with using Parcel Dec 4, 2020
@Harzu
Copy link
Owner

Harzu commented Feb 20, 2021

@harunoz Hello =) I'm sorry. I didn't notice the issue right away

When i researched build a wasm module with any build managers. I couldn't build a lib with the parcel and rollup builders. If you want help me to resolve the problem, let me know please. I will be grateful any help.

I going to try build again. if i succeed then i going to write example

@Harzu Harzu added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jan 15, 2022
@Harzu Harzu self-assigned this Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants