google-fonts icon indicating copy to clipboard operation
google-fonts copied to clipboard

[Bundling failed]: node_modules/@expo-google-fonts/dev/index.js: Maximum call stack size exceeded

Open ftzi opened this issue 4 years ago • 8 comments

I just found out expo-google-fonts/dev and added to my code import { Inter_600SemiBold } from '@expo-google-fonts/dev'. Now, when building my expo app on launch, the following error is raised:

Android Bundling failed 10115ms
node_modules/@expo-google-fonts/dev/index.js: /home/hb/Dev/MyAppName/app/node_modules/@expo-google-fonts/dev/index.js: Maximum call stack size exceeded
RangeError: /home/hb/Dev/MyAppName/app/node_modules/@expo-google-fonts/dev/index.js: Maximum call stack size exceeded
    at PluginPass.ReferencedIdentifier (/home/hb/Dev/MyAppName/app/node_modules/@babel/helper-define-polyfill-provider/lib/visitors/usage.js:20:25)
    at PluginPass.newFn (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/visitors.js:218:17)
    at newFn (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/context.js:103:16)
    at TraversalContext.visitSingle (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/context.js:77:19)
    at TraversalContext.visit (/home/hb/Dev/MyAppName/app/node_modules/@babel/traverse/lib/context.js:131:19)

ftzi avatar Oct 28 '21 00:10 ftzi

did u figure it out? same problem

dli0793 avatar Oct 30 '21 20:10 dli0793

No :/ I had to install all the fonts I wanted to try out, then removed the ones I didn't like :P

ftzi avatar Oct 30 '21 20:10 ftzi

how do you do that? and does that fix the problem?

dli0793 avatar Oct 30 '21 21:10 dli0793

Let's say I wanted to try the 'inter' font. So, as readme says, expo install @expo-google-fonts/inter and try it out. It fixes the problem as I am no longer using the @expo-google-fonts/dev, but the individual and local fonts, not downloading them on the go.

ftzi avatar Oct 30 '21 21:10 ftzi

i see what u mean. i figured out how to fix it by going in the index.js file and deleting the fonts I did not want

dli0793 avatar Oct 30 '21 21:10 dli0793

That's a simple and a clever solution! I also thought previously that the 6k file with its exports was causing the problem, but hadn't the idea of cleaning it. I am curious on how the author are going to fix it (and to know what is causing the error). Maybe using js Proxy somehow? JSON? Regex?

ftzi avatar Oct 30 '21 21:10 ftzi

I'm not sure what the problem is here. I'll try to investigate soon. If anyone figures out what's going on here and how to fix it in the meantime, contributions are welcome.

ccheever avatar Nov 05 '21 00:11 ccheever

Had this problem for weeks, thanks for the fix. Importing directly not using /dev worked. ^^

imaron85 avatar Nov 07 '21 11:11 imaron85