Error: Recoil version 0.0.8 in SSR - window is not defined

In case of Recoil version 0.0.8 in SSR, window is not defined Error happens. You could use version 0.0.7 until version 0.0.9 release

Problem Recoil 0.0.8

【UPDATED】Already Resolved!

This problem was resolve by releasing Recoil version 0.0.10 at Jun. 18th 2020.

Point of SSR Problem

For applications that use NextJS, Gatsby and so on in SSR, Recoil version 0.0.8 cause the following error in server side.

ReferenceError: window is not defined
    at Object.<anonymous> (C:\home\pjs\file-translate\node_modules\recoil\dist\recoil.development.js:591:3)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)

Solution

Some people advised the way to force a solution, but the development team recognized it.

So it's best to drop the version to 0.0.7 and wait for version 0.0.9. It is expensive to fix the source code for a specific bug that is likely to be fixed.

Recoil is so convenient that I want it to stabilize quickly. The following article is detailed about Recoil.

Updated at: Fri Jun 26 2020

© 2020-presentTerms|Privacy