React(vite,ts) app Vercel Deployment Error: SyntaxError with Axios #5879
Replies: 6 comments
-
I ran into the same problem. Your dependencies helped me to find out what our projects have in common and to target the issue. Try removing following from
This helped me. |
Beta Was this translation helpful? Give feedback.
-
Have you tried with skipLibraryCheck "compilerOptions": {
"skipLibCheck": true,
...
} |
Beta Was this translation helpful? Give feedback.
-
Thank you for all your help! @Charlygraphy23 @jklanica |
Beta Was this translation helpful? Give feedback.
-
I am trying the both solutions but it is not working for me. Vue-js project, with Vite configuration |
Beta Was this translation helpful? Give feedback.
-
✓ 181 modules transformed. I had error like this and fixed by: define: { in vite.config.ts |
Beta Was this translation helpful? Give feedback.
-
Adding my 2c Js not ts, i get {} global error while building at Vercel, then global error running it. I had to change BOTH |
Beta Was this translation helpful? Give feedback.
-
Describe the issue
I am currently working on a React-TypeScript project. I tested it locally with mocking using msw and now I am trying to deploy it on Vercel. However, during the deployment on Vercel, I keep encountering the following error related to Axios: "SyntaxError: Unexpected token (705:2) in /vercel/path0/node_modules/axios/lib/utils.js." I want to resolve this error.
I have tried the following steps to fix the error:
Additionally, I tried the following based on an existing Axios issue (#464):
6. Removed "default" from "export default" in nodemoduls/axios/lib/axios.js.
7. Deleted nodemodules and package.lock and reinstalled.
8. Tried adding "main": "dist/axios.js" to package.json.
However, the error remains the same, and the deployment is still not successful.
The error message points to the "
export default {...,global: _global,...}
" part in axios/utils.js at line 705:2.I need help resolving this issue. Thank you.
![image](https://user-images.githubusercontent.com/67778391/228118356-bb0820c7-b0a3-47bf-9406-b51e6a48d474.png)
Example Code
Expected behavior
No response
Axios Version
1.3.3.,1.3.4.
Adapter Version
HTTP
Browser
Chrome
Browser Version
111.0.5563.110(arm64)
Node.js Version
v18.14.0
OS
No response
Additional Library Versions
Additional context/Screenshots
No response
Beta Was this translation helpful? Give feedback.
All reactions