Skip to content

Commit d259900

Browse files
committed
fix: hook import not working
1 parent ae4918f commit d259900

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,19 @@ module.exports = {
101101
'no-console': 'off',
102102
},
103103
},
104+
{
105+
files: [
106+
'packages/app-backend-core/src/hook.ts',
107+
],
108+
rules: {
109+
'no-restricted-syntax': ['error', {
110+
selector: 'ImportDeclaration',
111+
message: 'File is injected with a `Function.toString()`, imports will not work',
112+
}, {
113+
selector: `CallExpression[callee.name='require']`,
114+
message: 'File is injected with a `Function.toString()`, require will not work',
115+
}],
116+
},
117+
},
104118
],
105119
}

packages/app-backend-core/src/hook.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// this script is injected into every page.
2-
import { isBrowser, target } from '@vue-devtools/shared-utils'
32

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

3837
let iframeChecks = 0
3938
function injectToIframes () {
40-
if (!isBrowser) return
39+
if (typeof window === 'undefined') return
4140

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

0 commit comments

Comments
 (0)