#788·automerge

wasm.__wbindgen_add_to_stack_pointer is not a function

Author: Sjoerd82Created Oct 29, 2023Updated Aug 26, 2026
Labelsbugjavascript

I just started playing with Automerge. I am looking to see if it can bring CRDT's to my offline-first app! This is a Quasar project, so everything is always a little different. I'm using the Quasar 2, Vue3, TS, Vite 2.

My code is basically just one of the examples.

In installed Automerge yarn add @automerge/automerge @automerge/automerge-repo. When I got an WASM-sounding error, I also added yarn add vite-plugin-wasm.I've never worked with WASM, and honestly, don't really understand how it works.

The code:

typescript
import {next as A} from '@automerge/automerge'

export function _testAm() {
    let doc = A.from({
        map: { 
            key: 'value',
            nested_map: {key: 'value'},
            nested_list: [1],
        },
        list: ['a', 'b', 'c', {nested: 'map'}, ['nested list']],
        // Note we are using the `next` API for text, so text sequences are strings
        text: 'some text',
        // In the `next` API non mergable strings are instances of `RawString`.
        // You should generally not need to use these. They are retained for backwards
        // compatibility
        raw_string: new A.RawString('rawstring'), 
        integer: 1,
        float: 2.3,
        boolean: true,
        bytes: new Uint8Array([1, 2, 3]),
        date: new Date(),
        counter: new A.Counter(1),
        none: null,
    })

    doc = A.change(doc, d => {
        // Insert 'Hello' at the begnning of the string
        A.splice(d, ['text'], 0, 0, 'Hello ')
        d.counter.increment(20)
        d.map.key = 'new value'
        d.map.nested_map.key = 'new nested value'
        d.list[0] = 'A'
        d.list.insertAt(0, 'Z')
        d.list[4].nested = 'MAP'
        d.list[5][0] = 'NESTED LIST'
    })
    
    console.log(doc)
}

It fails on A.from( with the error wasm.__wbindgen_add_to_stack_pointer is not a function.

I suspect maybe it's a Vite and/or WASM issue.. Does this error mean anything to anyone?