PlasmoHQ/plasmo

[BUG] "TypeError: Failed to fetch" when package tries loading file via fetch(url)

Opened this issue · 1 comments

What happened?

plasmo isn't bundling some files used by third party packages
when calling the init function of tlsn-js, it tries to load a .wasm file by doing

// ./node_modules/tlsn-js/wasm/pkg/tlsn-wasm.js
input = new URL('tlsn_wasm_bg.wasm', import.meta.url);
// ...
input = fetch(input);

but it seems that this wasm file isn't being bundled by plasmo so that fetch fails
image
image

I've set up a minimal example in this repo

Version

Latest

What OS are you seeing the problem on?

Windows, Linux

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contribution

  • I would like to fix this BUG via a PR

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.

Put the paths to the files you need embedded in your extension into the web_accessible_resources key of your package.json (see the mv3 manifest definition for more details). If you include them here, plasmo will bundle the assets and you can then access them from your code.