Where to put polyfills in the new router ? #25122
-
Hi!
I have also tried putting it into the index.tsx file, but that didn't seem to make a difference. _layout.tsx import "@/comps/polyfillA" // runs after the {something } import
import { something } from "moduleNeedingPolyfill" // runs before first import it used to be that you could put your polyfills into the index.js file (which worked), but that is now gone, how could I resolve this now ? I can create an example, but that won't work on snack as it doesn't support the new router yet. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Create an index.js file and make your polyfill the first import: import 'polyfill'
import 'expo-router/entry' Then change the main field in the |
Beta Was this translation helpful? Give feedback.
Create an index.js file and make your polyfill the first import:
Then change the main field in the
package.json
to point to the"main": "./index"
.