Skip to content

Commit

Permalink
fix: hook import not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Mar 14, 2022
1 parent ae4918f commit d259900
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,19 @@ module.exports = {
'no-console': 'off',
},
},
{
files: [
'packages/app-backend-core/src/hook.ts',
],
rules: {
'no-restricted-syntax': ['error', {
selector: 'ImportDeclaration',
message: 'File is injected with a `Function.toString()`, imports will not work',
}, {
selector: `CallExpression[callee.name='require']`,
message: 'File is injected with a `Function.toString()`, require will not work',
}],
},
},
],
}
3 changes: 1 addition & 2 deletions packages/app-backend-core/src/hook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// this script is injected into every page.
import { isBrowser, target } from '@vue-devtools/shared-utils'

/**
* Install the hook on window, which is an event emitter.
Expand Down Expand Up @@ -37,7 +36,7 @@ export function installHook (target, isIframe = false) {

let iframeChecks = 0
function injectToIframes () {
if (!isBrowser) return
if (typeof window === 'undefined') return

const iframes = document.querySelectorAll<HTMLIFrameElement>('iframe:not([data-vue-devtools-ignore])')
for (const iframe of iframes) {
Expand Down

0 comments on commit d259900

Please sign in to comment.