I
I
IIITRIX2019-02-26 21:14:32
Building projects
IIITRIX, 2019-02-26 21:14:32

How to fix ReferenceError: window is not defined?

Everything works fine without assembly. When assembling such a problem
ReferenceError: window is not defined

at eval (webpack:///./src/editor/dist/editor.js?:14:3)
    at Object../src/editor/dist/editor.js (\build\index.js:1631:1)
    at __webpack_require__ (\build\index.js:684:30)
    at fn (\build\index.js:61:20)
    at eval (webpack:///./src/forms/ArticleForm.js?:23:84)
    at Module../src/forms/ArticleForm.js (\build\index.js:1643:1)
    at __webpack_require__ (\build\index.js:684:30)
    at fn (\build\index.js:61:20)
    at eval (webpack:///./src/pages/CreateArticlePage.js?:12:76)
    at Module../src/pages/CreateArticlePage.js (\build\index.js:1868:1)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2020-03-09
@IIITRIX

if (typeof window !== 'undefined') {
  // код, который выполнится только в браузере
} else {
 // код, который выполнится только на сервере
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question