Open aklinker1 opened 2 weeks ago
Dealing with loading your content script correctly in SPAs is really annoying. WXT should be able to do it for you.
export default defineContentScript({ matches: ['*://*.youtube.com/watch*'], spa: true, main(ctx) { console.log('YouTube content script loaded'); mountUi(ctx); }, });
N/A
As the docs state, manually listening to URL changes works. But managing ctx correctly is annoying, and not shown in the docs. This would also create ctx for each URL path, so the script can shut down properly when the path changes.
ctx
– https://discord.com/channels/1212416027611365476/1224500470278520904/1291359490121138207
This won't be an easy first-contribution, but it should be relatively easy to implement:
spa
spa: true
Feature Request
Dealing with loading your content script correctly in SPAs is really annoying. WXT should be able to do it for you.
Is your feature request related to a bug?
N/A
What are the alternatives?
As the docs state, manually listening to URL changes works. But managing
ctx
correctly is annoying, and not shown in the docs. This would also create ctx for each URL path, so the script can shut down properly when the path changes.Additional context