Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Issue In SSR #4

Open
saaiful opened this issue Apr 7, 2018 · 1 comment
Open

Issue In SSR #4

saaiful opened this issue Apr 7, 2018 · 1 comment

Comments

@saaiful
Copy link

saaiful commented Apr 7, 2018

After building everything successfully, I started the render_server and reloaded my site and I get following error:
ReferenceError: window is not defined at Object.<anonymous> (__vue_ssr_bundle__:16465:1) at __webpack_require__ (__vue_ssr_bundle__:21:30) at Object.<anonymous> (__vue_ssr_bundle__:14206:1) at __webpack_require__ (__vue_ssr_bundle__:21:30) at Object.module.exports.Object.defineProperty.value (__vue_ssr_bundle__:14134:12) at __webpack_require__ (__vue_ssr_bundle__:21:30) at __vue_ssr_bundle__:64:18 at Object.<anonymous> (__vue_ssr_bundle__:67:10) at evaluateModule (D:\wamp64\www\beezoy-ssr\node_modules\vue-server-renderer\build.js:8338:21) at D:\wamp64\www\beezoy-ssr\node_modules\vue-server-renderer\build.js:8374:17

@exodusanto
Copy link
Owner

Hi, this is the same problem in Nuxt.js

window is not defined on node runtime, you have to check if the code is running on server or browser.

Here an example:

created(){
    if(process.browser === true){
        var array = window.Array();
        array.push("ok");
        window.arraytest = array;
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants