I am building a Firefox addon using Rust. I am trying to insert HTML and do stuff on specific pages. Apparently, a content script is the thing I want to use. My content script is:
import("../crate/pkg").then(({ Addon }) => {
const addon = Addon.new();
console.log(addon.where_am_i());
}).catch(e => console.error("Error importing:", e));
The error I am getting is:
TypeError: "0125c9960050e7483877.module.wasm is not a valid URL."
I tried to add to manifest.json
:
"web_accessible_resources": [
"0125c9960050e7483877.module.wasm"
]
I accessed it as moz-extension://<extension-UUID>/0125c9960050e7483877.module.wasm"
but then I got:
Error importing: Error: "Loading chunk 0 failed.
I also tried a background script, but that is loaded in extension context so it doesn't allow me to alter page content.