-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add web target to pkg builder in makefile #39
Conversation
Codecov Report
@@ Coverage Diff @@
## main #39 +/- ##
==========================================
- Coverage 16.45% 12.75% -3.71%
==========================================
Files 12 12
Lines 468 447 -21
==========================================
- Hits 77 57 -20
+ Misses 391 390 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I assume this must be related to nucypher/taco-web#120 Does this technique fix the aforementioned issue? Did we test that locally? |
yeah that's what I'm trying out now |
If you run I added a simple <html>
<head>
<script src="./nucypher_core_wasm.js"></script>
</head>
<body>
<script>
fetch("./nucypher_core_wasm_bg.wasm")
.then(response => response.arrayBuffer())
.then(buffer => WebAssembly.instantiate(buffer))
.then(wasm => {
const cond = Condition();
});
</script>
</body>
</html> This can then be opened with I'm not really sure why the export is unexpected @piotr-roslaniec |
@theref <script type="module" src="./nucypher_core_wasm.js"></script> We can find confirmation for this workaround in |
@piotr-roslaniec Thank you, that link was really helpful and everything is working!
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
</head>
<body>
<script type="module">
import init, { PublicKey } from './nucypher_core_wasm.js';
async function run() {
await init();
const pk = new PublicKey();
console.log(pk);
}
run();
</script>
</body>
</html> There is a bit of work to do to get the MIME types working correctly with the server. So create from http.server import HTTPServer, SimpleHTTPRequestHandler
class MyRequestHandler(SimpleHTTPRequestHandler):
# Set the MIME type for .wasm files to application/wasm
MIMETypes = {
".wasm": "application/wasm"
}
# Start the HTTP server on port 8000
httpd = HTTPServer(('localhost', 8000), MyRequestHandler)
httpd.serve_forever() And then |
@theref I'm glad to see that it works. Could we also get a confirmation that it simplifies |
Rebased over #40 |
Needs a few minor things:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get it in 👌
@theref, could you put the changes under |
Disregard that, merged in #42 |
Aims to fix nucypher/taco-web#120