fiduswriter/diffDOM

`window is not defined`

sntran opened this issue · 5 comments

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

@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:

document: window && window.document ? window.document : false
. And that line should take care of both cases where there is a window/window.document and one where there is not one.

@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:

document: window && window.document ? window.document : false

. And that line should take care of both cases where there is a window/window.document and one where there is not one.

actually this should probably be document: typeof window !== 'undefined' && window.document ? window.document : false

@lexoyo will fix now

Thanks!