Closed Manik-Jain closed 2 years ago
This problem occurs when trying to import the wasm lib
Get a webpack 5 version and enable experiments
This allows wasm import and fixes the problem
npx create-react-app does NOT work The webpack version with this template is 3
Just search for webpack 5 template (React, ...)
Hi. Can you expand on how to use the wasm?
I am importing like this:
async initWasm() { this.WASM_lib = await import('@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib'); }
And I am using webpack with this config:
module.exports = { experiments: { asyncWebAssembly: true, outputModule: true, syncWebAssembly: true, topLevelAwait: true, } };
I works locally, but when deploying it throws this error:
Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm
Any idea? I am trying to use it in an Angular App.
Hi,
I've tried to use your provided NPM package. Sadly, I've been running into memory leak.
<--- Last few GCs --->
[9052:0x1046c6000] 84325 ms: Mark-sweep (reduce) 2044.5 (2051.0) -> 2044.1 (2052.8) MB, 2973.6 / 0.1 ms (average mu = 0.111, current mu = 0.002) allocation failure scavenge might not succeed [9052:0x1046c6000] 88877 ms: Mark-sweep (reduce) 2045.2 (2054.8) -> 2044.8 (2054.8) MB, 4547.0 / 0.0 ms (average mu = 0.048, current mu = 0.001) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x1012e4da5 node::Abort() (.cold.1) [/usr/local/bin/node] 2: 0x1000a6239 node::Abort() [/usr/local/bin/node] 3: 0x1000a639f node::OnFatalError(char const, char const) [/usr/local/bin/node] 4: 0x1001e9007 v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, bool) [/usr/local/bin/node] 5: 0x1001e8fa3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [/usr/local/bin/node] 6: 0x100397e95 v8::internal::Heap::FatalProcessOutOfMemory(char const) [/usr/local/bin/node] 7: 0x10039995a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node] 8: 0x100395029 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node] 9: 0x1003928c1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node] 10: 0x1003a115a v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 11: 0x1003a11e1 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 12: 0x10036eb87 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node] 13: 0x1006ed8d8 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate*) [/usr/local/bin/node] 14: 0x100a7a239 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node] 15: 0x100a75b11 Builtins_WeakSetConstructor [/usr/local/bin/node] 16: 0x100a0f761 Builtins_JSBuiltinsConstructStub [/usr/local/bin/node] 17: 0x5adb7aad2fd