reactjs / react-transition-group

An easy way to perform animations when a React component enters or leaves the DOM
https://reactcommunity.org/react-transition-group/
Other
10.14k stars 651 forks source link

Consider removing process.env.NODE_ENV check? #723

Open tnguyen14 opened 3 years ago

tnguyen14 commented 3 years ago

I am using react-bootstrap with skypack.dev, and it relies on react-transition-group heavily.

However, any component that uses react-transition-group fails because process doesn't exist in a browser environment.

https://github.com/reactjs/react-transition-group/blob/70d1314d185e152b7754ab363e0ae088409858d5/src/utils/PropTypes.js#L4

Could this use be removed/ refactored, or make it browser-friendly somehow?

jquense commented 3 years ago

removing wouldn't really help i don't think, many many React packages use the same convention, including React itself: https://unpkg.com/browse/react@17.0.2/index.js other bundlers handle this case automatically by removing these NODE_ENV cases with constant values that allow minifiers to remove unused code.

tnguyen14 commented 3 years ago

Thanks for responding.

I think skypack uses a browser optimized version https://cdn.skypack.dev/react@17. I am not sure how it does that though.