How to run treesitter (with web assembly) in chrome extension

65 Views Asked by At

I'm trying to load treesitter web in a chrome extension, however it always fails with

tree-sitter.js:1 wasm streaming compile failed: CompileError: WebAssembly.instantiateStreaming():

enter image description here

the wasm file loads correctly according to the network tab (it can be decoded correctly), and I updated the manifest so it should allow web assembly. It's very unclear why it's failing

{
    "manifest_version": 3,
   ...
    "content_security_policy": {
        "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; default-src 'self';"
    },
    "host_permissions": [
        "https://*/*"
    ],
    "permissions": [
        "activeTab",
        "scripting"
    ],
    "web_accessible_resources": [
        {
            "resources": ["tree-sitter/typescript.wasm", "tree-sitter.wasm", "tree-sitter.js"],
            "matches": ["<all_urls>"]
        }
    ]
}

What's going wrong?

0

There are 0 best solutions below