You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you attempt to use a Javascript file ending in ".cjs" in an expo webpack build, then it will fail to include that file in the source file compilation. Instead, it treats those files as "assets".
The same problem seems to exist in "create react app", so I guess maybe Expo is using the same webpack config under the hood: facebook/create-react-app#12021
Currently you can work around the issue by overriding the expo webpack config using a similar workaround to what is described here: facebook/create-react-app#12021 (comment)
Please specify your device/emulator/simulator platform, model and version
web, chrome browser
Error output
No response
Reproducible demo or steps to reproduce from a blank project
Try to use any package that uses .cjs files in a newly generated expo project, after running npm run web and viewing the page on a browser you can see errors related to the file usage.
The specific package I was testing with was 'axios', simply trying to create a client:
importaxiosfrom'axios'// this will error claiming that axios does not existaxios.create()
The text was updated successfully, but these errors were encountered:
Summary
If you attempt to use a Javascript file ending in ".cjs" in an expo webpack build, then it will fail to include that file in the source file compilation. Instead, it treats those files as "assets".
The same problem seems to exist in "create react app", so I guess maybe Expo is using the same webpack config under the hood:
facebook/create-react-app#12021
Currently you can work around the issue by overriding the expo webpack config using a similar workaround to what is described here:
facebook/create-react-app#12021 (comment)
Environment
Please specify your device/emulator/simulator platform, model and version
web, chrome browser
Error output
No response
Reproducible demo or steps to reproduce from a blank project
Try to use any package that uses
.cjs
files in a newly generated expo project, after runningnpm run web
and viewing the page on a browser you can see errors related to the file usage.The specific package I was testing with was 'axios', simply trying to create a client:
The text was updated successfully, but these errors were encountered: