`window is not defined`
sntran opened this issue · 5 comments
sntran commented
When trying to use diff-dom
in a web extension for vscode, the following error occurs:
ReferenceError: window is not defined
at node_modules/diff-dom/dist/index.js (extension.js:641:76)
That line is:
document: !(!window || !window.document) && window.document
johanneswilm commented
sntran commented
The file distributed in NPM has that line: https://cdn.jsdelivr.net/npm/diff-dom@4.2.3/dist/index.js#:~:text=document%3A!(!window%7C%7C!window.document)%26%26window.document.
lexoyo commented
@sntran It looks to me like that is something dependent on your package. The only place this shows up in the original file is here:
Line 25 in 85df21a
. And that line should take care of both cases where there is awindow
/window.document
and one where there is not one.
actually this should probably be document: typeof window !== 'undefined' && window.document ? window.document : false
johanneswilm commented
@lexoyo will fix now
sntran commented
Thanks!