New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt 2.X can't import Axios #5243
Comments
Hi 👋 Please try the latest pre-release by running the following: npm i axios@1.2.0-alpha.1 Please provide feedback in either the pinned issue or discussion thread 🧵 |
Hi :) sorry for the delay. I still have the same issue :( |
It's complaining about node_modules/vue-server-renderer/build.dev.js |
Hi there, I reckon I have the same issue. I'm stuck at axios 0.27.2 and can't upgrade to 1.0.0-alpha.1 or the latest one 1.3.4 for a Nuxt project (nuxt 2.15.8 and node 16.19) Error is displayed in browser window :
Showing this part of code from the
I don't get why this topic is marked as closed, same for this one probably talking about the same problem ; the only "solution" offered is to revert to older version but it's not a real solution ^^ Thanks for your work, time and help! |
|
Did anyone try using build.transpile in the nuxt.config file? This solved the issue for me as babel would transpile the code to be CJS compatible |
this worked for me thank you! build: {
transpile: [({ isLegacy }) => isLegacy && 'axios']
}, |
Thanks for the suggestion @jcao02 and thanks for the code to add in nuxt.config @andrewscfl. It worked for me, I managed to update axios to the latest version. EDIT: I add to rollback to version 0.27.2 ; one of my API route was down, didn't take the time to investigate. :( |
* Update dependency axios to v1 [SECURITY] * Fix jest build for axios * Fix axios import for vue-server-renderer axios/axios#5243 * Fix axios mock adapter import --------- Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com>
Describe the bug
I just upgrade Axios to V1 in a Nuxt 2 project and I'm getting this error:
We use import
import axios from 'axios'
throughout the code inasyncData
(Server) and in the browser sideTo Reproduce
No response
Code snippet
No response
Expected behavior
No response
Axios Version
1.1.3
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
16.14.2
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: