Skip to content

Commit

Permalink
fix: stackblitz support
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 30, 2023
1 parent ace5d5b commit 33e83ae
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/devtools/src/runtime/plugins/devtools.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ import { setupHooksDebug } from '../shared/hooks'
import { defineNuxtPlugin, useRouter, useState } from '#imports'

export default defineNuxtPlugin((nuxt: any) => {
if (window.__NUXT_DEVTOOLS_DISABLE__ || window.parent?.__NUXT_DEVTOOLS_DISABLE__)
return

// TODO: Stackblitz support?
if (typeof document === 'undefined' || typeof window === 'undefined')
return

if (window.parent && window.self !== window.parent) {
try {
if (window.parent.__NUXT_DEVTOOLS_VIEW__ || window.parent.document.querySelector('#nuxt-devtools-container'))
try {
if (window.__NUXT_DEVTOOLS_DISABLE__ || window.parent?.__NUXT_DEVTOOLS_DISABLE__)
return

if (parent && window.self !== parent) {
if (parent.__NUXT_DEVTOOLS_VIEW__ || parent.document.querySelector('#nuxt-devtools-container'))
return
}
catch (e) {
}
}
catch (e) {
console.error('Nuxt DevTools: Failed to check parent window')
console.error(e)
}

const timeMetric = window.__NUXT_DEVTOOLS_TIME_METRIC__ = shallowReactive(window.__NUXT_DEVTOOLS_TIME_METRIC__ || {})
Expand Down

0 comments on commit 33e83ae

Please sign in to comment.