wxt icon indicating copy to clipboard operation
wxt copied to clipboard

Add unlisted script to web_accessible_resources automatically

Open ion1 opened this issue 9 months ago • 1 comments

Feature Request

It would be nice to have the appropriate web_accessible_resources entry added automatically based on the matches property.

// main-injected.ts
export default defineUnlistedScript({
  matches: ["https://example.net/*"],
  main() {
    // ...
  },
});

The entry can probably be added with use_dynamic_url: true by default.

Perhaps HTML pages could also have something like the following for the same effect:

<meta name="manifest.matches" content="['https://example.net/*']" />

Thanks!

Is your feature request related to a bug?

N/A

What are the alternatives?

Keeping things as-is.

Additional context

N/A

ion1 avatar Jun 17 '25 02:06 ion1

I have the same issue. When I first tried to use injectScript, I didn't know that I needed to add injected.js to web_accessible_resources, and as a result, an error occurred. I would like to ask why it isn't added automatically. Since it's placed in the entrypoints directory, is it supposed to be used?

MarvinXu avatar Oct 07 '25 04:10 MarvinXu