Skip to content

Trying to use Blake3 in React with TS. Build Warnings and Runtime Errors #43

Description

@allidoisace

Runtime

index.tsx

import('blake3/browser').then(blake3 => {
  console.log(blake3.hash('foo')); // => Uint8Array
});

ReactDOM.render(
  ...
);
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'wasm2.memory.buffer')
	getUint8Memory0 (blake3_browser.js:38)
	hash2 (blake3_browser.js:60)
	hash3 (blake3_browser.js:240)
	(anonymous function) (index.tsx:12)
	promiseReactionJob

As posted in an issue elsewhere, they recommended changing the .d.ts names, but they are already present in this version.
wasm-bindgen/wasm-bindgen#2200
Screen Shot 2022-04-28 at 1 13 50 PM

Build Warnings

'memory' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'memory' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'hash' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'create_hasher' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'create_keyed' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_realloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'create_derive' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbg_blake3hash_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'blake3hash_reader' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'blake3hash_update' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'blake3hash_digest' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbg_hashreader_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_malloc' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'hashreader_fill' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'__wbindgen_free' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'
'hashreader_set_position' is not exported by 'node_modules/blake3/dist/wasm/browser/blake3_js_bg.wasm'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions