Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/extension/src/inject/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
busDispatch,
busSubscribe,
canLoadReactScan,
isHtmlPage,
hasReactFiber,
readLocalStorage,
saveLocalStorage,
Expand Down Expand Up @@ -89,6 +90,10 @@ const updateReactScanState = async (isEnabled: boolean | null) => {
void initializeReactScan();

window.addEventListener('DOMContentLoaded', async () => {
if (!isHtmlPage) {
return;
}

if (!canLoadReactScan) {
return;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/extension/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export const isIframe = window !== window.top;
export const isPopup = window.opener !== null;
export const canLoadReactScan = !isIframe && !isPopup;

export const isHtmlPage = document.contentType === "text/html";

export const IS_CLIENT = typeof window !== 'undefined';

export const isInternalUrl = (url: string): boolean => {
Expand Down
Loading