Clinical-Genomics / statina-ui

Frontend app for Statina
0 stars 0 forks source link

Update to React 18 #158

Closed elevu closed 1 year ago

elevu commented 2 years ago

https://reactjs.org/blog/2022/03/29/react-v18.html

elevu commented 2 years ago

wait for the craco package to support React 18

moedarrah commented 1 year ago

I've come across a problem when trying to update to React 18. Certain packages in our project, such as 'probe-image-size', seem to be having issues because they need the 'stream' module, which is part of node.js.

The upgrade to React 18 uses webpack 5, which has made some changes. One of those changes is that it no longer automatically includes certain features that come with node.js, known as polyfills. The 'stream' module is one of those features, and without it, our project won't compile properly.

The exact error we get is: Module not found: Error: Can't resolve 'stream' in '/Users/mohammed.darrah/gits/statina-ui/node_modules/probe-image-size/lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.

We could fix this by manually adding back the 'stream' module with a workaround, but that's more of a temporary patch. I think it's a better idea to hold off on updating to React 18 until a more lasting fix is available.

elevu commented 1 year ago

Which packages that we are directly using are causing this? probe-image-size is a dependency, but of which package?

moedarrah commented 1 year ago

It seems that plotly.js requires a polyfill to operate with the probe-image-size library.

moedarrah commented 1 year ago

Done!