I have the following snippet from my Vite/Zustand react project.

import { create } from 'zustand'
import {AsBind} from 'as-bind';

const useStatsStore = create((set, get) => ({
    statsWasm: null,
    loadedStatsWasm: false,
    loadStatsWasm: async () => {
        const wasm = await fetch('my-wasm.wasm');
        console.log('statsWasm', wasm);
        const instance = await AsBind.instantiate(wasm, {});
        set({statsWasm: instance});
    runStats: () => {
        const wasm = get().statsWasm;

export default useStatsStore;

But when I load the project, I get this error in the javascript console, and the page fails to load

Uncaught SyntaxError: ambiguous indirect export: AsBind

The syntax error is listed as that 2nd line where I import AsBind.

I've tried import AsBind from 'as-bind' and import * as AsBind from "as-bind" as well, and neither work.

Why am I getting this error simply trying to import it?

  • 8,171
  • 16
  • 57
  • 104
  • `as-bind` has been deprecated. The AssemblyScript compiler (`asc`) has native support for bindings now: https://www.assemblyscript.org/compiler.html#host-bindings. I would suggest recompiling with `--bindings` and getting rid of the `as-bind` import altogether. – TachyonicBytes Jun 17 '23 at 23:34

0 Answers0