React-transition-group: SSR in 4.4.0 crashes

Created on 5 May 2020  路  12Comments  路  Source: reactjs/react-transition-group

What is the current behavior?

Running this module on node.js (for example during ssr) results in: ReferenceError: Element is not defined

What is the expected behavior?

Importing react-transition-group does not result in an error

The problem is this line:
https://github.com/reactjs/react-transition-group/blob/c8631587f9e1d18f5161f5490e6f5c225f06c6ae/src/Transition.js#L397

A possible solution is: Element = typeof Element === 'undefined' ? function(){} : Element

released

Most helpful comment

:tada: This issue has been resolved in version 4.4.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

All 12 comments

I too ran through the error exactly two hours ago. We tried getting rid of 'react-transition-group' LMAO!
Hope it serves as a temporary solution for ongoing development for me personally.
Cheerio!

@perrin4869 I do too. I tried commenting out the following code on '/node_modules/react-transition-group/cjs/Transition.js' in line 451.
VERY UNCONVENTIONAL WAY TO SOLVE A PROBLEM!
In case, you in need of any immediate solution, hope it works well for you too.
Would love to know more if a solution is up!

  nodeRef: _propTypes.default.shape({
    current: _propTypes.default.instanceOf(Element)
  }),

鈿狅笍 The reference to Element changes between windows (popups, iframes). Prefer testing node.nodeType === 1.

Having issues right now after updating my npm packages

Same problem here, using material-ui on nextjs:

ReferenceError: Element is not defined
    at Object.<anonymous> (/home/ric/code/anyway/node_modules/react-transition-group/cjs/Transition.js:452:44)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/ric/code/anyway/node_modules/react-transition-group/cjs/CSSTransition.js:14:42)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/ric/code/anyway/node_modules/react-transition-group/cjs/index.js:6:45)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)

Is this fixed?

Is this fixed?

i dont think so because version is still 4.4.0.
https://github.com/reactjs/react-transition-group/issues/618

+1

+1

I too ran through the error exactly two hours ago. We tried getting rid of 'react-transition-group' LMAO!
Hope it serves as a temporary solution for ongoing development for me personally.
Cheerio!

make it 4.3.0 from 4.4.0 version

+1 make it 4.3.0 from 4.4.0 version

:tada: This issue has been resolved in version 4.4.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings