React-select: react-input-autosize "window" reference breaks test environment

Created on 9 Jan 2018  路  5Comments  路  Source: JedWatson/react-select

Are you reporting a bug or runtime error?

Yes.

Version

Any version of react-select that pulls in react-input-autosize at 2.2.0.

Summary

Our test suite will no longer run (in a headless environment) due to this error:

/node_modules/react-input-autosize/lib/AutosizeInput.js:57
var isIE = typeof window === 'undefined' && window.document ? false : /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent);
                                            ^

ReferenceError: window is not defined
    at Object.<anonymous> (/Users/emily/webapp/node_modules/react-input-autosize/lib/AutosizeInput.js:57:45)

Most helpful comment

All 5 comments

Original version number I posted was incorrect. Should have been react-input-autosize at 2.2.0. Leaving this comment in case it triggers an email or something.

This is the issue.

Is there an easy way to get around this? This is causing build failures in my production instances and will most definitely become a P0 issue if we can't find a solution.

It is an upstream react-input-autosize problem, and it has been fixed with this PR.

Was this page helpful?
0 / 5 - 0 ratings