Giter Site home page Giter Site logo

Comments (16)

benediamond avatar benediamond commented on September 2, 2024

i installed it using yarn add mcl-wasm. is this correct?

from mcl-wasm.

herumi avatar herumi commented on September 2, 2024

What browser do you use?
Open
https://herumi.github.io/mcl-wasm/browser/demo.html
and run 'test IBE'. Does it run?

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

chrome 95.0.4638.54. yes, it runs.

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

but i noticed in that test page, you directly import mcl.js as a script in your html page. whereas I'd rather import it from within my other javascript files, not directly in the html file.

from mcl-wasm.

herumi avatar herumi commented on September 2, 2024

Thanks for the information.
When I check import mcl from 'mcl-wasm/'; with React before, it runs well.
I'll check it again for the latest version.

from mcl-wasm.

herumi avatar herumi commented on September 2, 2024

https://github.com/herumi/misc/tree/master/react/test2 is a tiny sample of mcl-wasm ith React and webpack. It runs well. Could you check it?

import mcl from "mcl-wasm/browser";

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

after going to public/, i get:

this is a test
1234567:894452905640319049678920984443007266612159160327439547902176562641551440349

with no errors in the console. so it looks like it works.

i still don't know what is going wrong on my end, but I can investigate further tomorrow. either way, this test will hopefully help me bootstrap a working setup. thanks for this. hopefully tomorrow i can diagnose and let you know what the issue is.

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

FYI, here is my stack trace:

ReferenceError: window is not defined
    at Object../node_modules/mcl-wasm/browser/src/index-browser.js (index-browser.js:3)
    at __webpack_require__ (bootstrap:24)
    at fn (hot module replacement:61)
    at Module../src/crypto/worker.js (bn128.js:20)
    at __webpack_require__ (bootstrap:24)
    at bootstrap:49
    at Function.__webpack_require__.O (chunk loaded:23)
    at __webpack_require__.x (bootstrap:50)

still working on diagnosing this.

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

update: i am able to get this to work in my main (non-worker) scripts. when i try to load mcl inside a worker, i get the error.

from mcl-wasm.

herumi avatar herumi commented on September 2, 2024

Could you write the minimum example?

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

I invited you to a repo containing a minimal example. can you let me know if you received it and can reproduce?

from mcl-wasm.

herumi avatar herumi commented on September 2, 2024

Worker has not window but self, so I fixed mcl-wasm to use it.
eda1ff4

cf. https://stackoverflow.com/a/48183681

  1. Add resolve: { fallback: { "crypto": false} } , to webpack.config.js.
  2. Use import mcl from "mcl-wasm/browser"; instead of import {mcl} from "mcl-wasm/browser";.

Then, I think it will run well.

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

works. many thanks!

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

hello! it seems that somewhere strictly after 0.9.0 but on-or-before 1.0.3, this issue reverted. can you please confirm whether you are able to reproduce? if not, i can provide an MWE. thanks.

from mcl-wasm.

herumi avatar herumi commented on September 2, 2024

Thank you for the information.

Please use

import * as mcl from 'mcl-wasm';

instead of

import mcl from "mcl-wasm";

from mcl-wasm.

benediamond avatar benediamond commented on September 2, 2024

this appears to work! many thanks as always for the great work.

from mcl-wasm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.