Expo Web + Reanimated: Metro error: requestAnimationFrame is not defined

75 Views Asked by At

This error prevented me from building my expo app for web (npx expo export -p web)

It seems this error only happens in expo SDK 49+

Here is a screenshot of the console logs, has you see stack trace is of no help at all:

enter image description here

Other than that I am using the default metro config.

1

There are 1 best solutions below

0
TOPKAT On BEST ANSWER

I finally found the solution after some days of work .

I just needed to npm install raf (requestAnimationFrame polyfill) and add those two lines to the metro.config.js:

const raf = require('raf')
raf.polyfill()

The metro.config.js may not exist, in this case you can create it according to this expo documentation