-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Add support for "main world" content scripts #284
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #284 +/- ##
==========================================
- Coverage 70.20% 69.98% -0.23%
==========================================
Files 133 135 +2
Lines 7395 7459 +64
Branches 575 580 +5
==========================================
+ Hits 5192 5220 +28
- Misses 2153 2187 +34
- Partials 50 52 +2 ☔ View full report in Codecov by Sentry. |
It seems this line might not reflect the recent breaking changes. Should it be updated to
|
@mefengl good catch! I'll fix it today |
This closes #282.
Now, when a content script is built, it will use different virtual entrypoints depending on the
world
option. If it'sundefined
or"ISOLATED"
, it will continue working as-is. If it's"MAIN"
, then a separate entrypoint is imported that doesn't load thewebextension-polyfill
, since main world content scripts run in a sandboxed environment without access to the extension APIs.BREAKING CHANGE: In order to isolate the
webextension-polyfill
from being imported automatically fromwxt/client
when importingdefineContentScript
,defineContentScript
anddefineBackgroundScript
have been moved fromwxt/client
towxt/sandbox
.