Open nicolasassi opened 1 year ago
I have the same problem with Svelte: Uncaught (in promise) SyntaxError: The requested module '/node_modules/.vite/deps/axios.js?v=db70df63' does not provide an export named 'AxiosInstance'
you can try that
import type { AxiosInstance } from "axios";
I am getting this issue Missing "./index" specifier in "axios" package when I have the above suggestion
I have the same problem with vue 3 and vite 5: Uncaught (in promise) SyntaxError: The requested module '/node_modules/.vite/deps/axios.js?v=db70df63' does not provide an export named 'axios'
Hey guys, has any one found the solution to this yet?
any solutions or updates on this?
based on another issue (that I can't find right now), I have to patch axios when using vite.
My patch looks like this:
diff --git a/package.json b/package.json
index 860d614056358d73a0525022bfe41b2aaa0d9b7e..c019f57adbabe20701c2232d1b6509bed72c212c 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
},
"browser": {
"require": "./dist/browser/axios.cjs",
- "default": "./index.js"
+ "default": "./dist/esm/axios.js"
},
"default": {
"require": "./dist/node/axios.cjs",
Hope that helps.
Describe the bug
In Vue3 / TypeScript project, import { AxiosError } from 'axios';
Build shows warning: Non-existent export 'AxiosError' is imported from node_modules/axios/index.js
Although there is only a build warning, any component (Vue) or TypeScript (ts) that includes this import fails to work. Browser console (Dev-Tools) shows:
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/axios.js?v=bd690d6d' does not provide an export named 'AxiosInstance'
To Reproduce
No response
Code snippet
No response
Expected behavior
Should not break
Axios Version
1.2.2
Adapter Version
No response
Browser
Chrome
Browser Version
No response
Node.js Version
v18.9.0
OS
macOs 12.6.2
Additional Library Versions
Additional context/Screenshots
No response