Nuxt.js: ReferenceError : "window is not defined"

Created on 17 Nov 2017  路  3Comments  路  Source: nuxt/nuxt.js

i want to use 'echart.js' but when i render the page, ReferenceError : "window is not defined" , how to fixed it? and i console.log(process.BROWSER_BUILD) and it's undefind

This question is available on Nuxt.js community (#c1893)
question

Most helpful comment

This happens with NUXT "SSR" option enabled, probably you are using a plugin or something that SSR (Server side rendering) cant resolve, there are two ways to solve this:

1- In you template use for remove SSR template parts.
2- In your JS scripts inside .vue file, use if(process.browser){//your code here} to bypass SSR.

This is to bypass the SSR, if you need your functions keeping the SSR, just search for another plugin...

All 3 comments

Since v1.0.0-rc3 process.BROWSER_BUILD has been removed in flavour of process.browser

https://github.com/nuxt/nuxt.js/releases/tag/v1.0.0-rc3

This happens with NUXT "SSR" option enabled, probably you are using a plugin or something that SSR (Server side rendering) cant resolve, there are two ways to solve this:

1- In you template use for remove SSR template parts.
2- In your JS scripts inside .vue file, use if(process.browser){//your code here} to bypass SSR.

This is to bypass the SSR, if you need your functions keeping the SSR, just search for another plugin...

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

o-alexandrov picture o-alexandrov  路  3Comments

vadimsg picture vadimsg  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

jaredreich picture jaredreich  路  3Comments

mikekidder picture mikekidder  路  3Comments