You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug tslog fails if used in Manifest V3 Chrome Extensions. More specifically it fails in background pages which now use service workers. The reason is that service workers do not have a window object. So the following code in tslog/dist/esm/runtime/browser/index.js fails: const meta = { runtime: "Browser", browser: window?.["navigator"].userAgent, };
To Reproduce
Steps to reproduce the behavior:
Create a basic Chrome Extension
Add tslog to a background script
Load the unpacked extension to your Chrome. To do that turn on the Developer mode on Extensions page.
Click on the "background page" link on your extension on Extensions page to open DevTools
Check the error in the Console of DevTools
Expected behavior
Extension should not fail.
Screenshots
Solution
Use self if window is not defined.
The text was updated successfully, but these errors were encountered:
Describe the bug
tslog fails if used in Manifest V3 Chrome Extensions. More specifically it fails in background pages which now use service workers. The reason is that service workers do not have a window object. So the following code in tslog/dist/esm/runtime/browser/index.js fails:
const meta = { runtime: "Browser", browser: window?.["navigator"].userAgent, };
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Extension should not fail.
Screenshots
Solution
Use self if window is not defined.
The text was updated successfully, but these errors were encountered: