Comments (5)
I've fixed this in 8c48e49.
There's now a new import, blake3/browser-async
, that exports an function which returns a promise that resolves to the module.
import load from 'blake3/browser-async';
load().then(blake3 => {
console.log(blake3.hash('hello world'));
});
I expanded the integration tests to test both Webpack and a plain <script type="module">
import.
from blake3.
Good issue. I didn't bother having an entirely separate, pure ES module tree here like I normally do because wasm is not tree shakable anyway. But I didn't recognize that that would trip up non-Webpack bundlers. Will make a patch release this evening or tomorrow.
from blake3.
Should be good to go in 2.0.1. ./browser.js
now points to an esm build. Let me know if you run into any more problems, happy hashing.
from blake3.
I just want to note that making it a ESM build just makes it easier to be imported into browsers without requiring a bundler, in the other hand it don't solves the issue.
The issue is that blake3_js.js imports "blake3_js_bg.wasm" as a ES module and it is not standardized yet, so browsers don't support it and some bundlers handle it in different ways than Webpack.
"blake3_js.js" is generated using wasm-pack and seems it don't support Parcel. You can use --target web
, which will create a module that already handles WASM loading without depending on the bundler implementation, but then you need to initialize the module manually.
So seems it's hard to implement without breaking backyards compatibility.
from blake3.
I'll look into this some more this evening most likely.
from blake3.
Related Issues (20)
- Threading support in native Node HOT 1
- Node 14 is not supported HOT 4
- Possibly incorrect wording in `hash` documentation? HOT 1
- Error trying to import bindings in Dockerfile HOT 1
- nodejs importing wasm HOT 2
- Online demo gives incorrect value
- Parcel compatibility
- Is this actively maintained? HOT 1
- Access the Merkle tree
- Another implementaion for Node.js with better performance and Support Matrix HOT 4
- blake3-wasm v2.1.7 for npm
- Module did not self-register HOT 1
- Problem during using npm i HOT 1
- Trying to use Blake3 in React with TS. Build Warnings and Runtime Errors HOT 2
- readme.md is incomplete for non webpack browser
- Can't install any of the blake3 packages via npm HOT 6
- Browser can't access WASM
- WASM Streaming compile failure on mobile devices
- npm install [email protected] — >> npm ERR! code ETARGET !!! >> npm ERR! notarget No matching version found for [email protected].
- Module not found: Error: Can't resolve './node.js' in '<project-path>/node_modules/blake3/esm'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blake3.