axios
axios copied to clipboard
Typescript imports not working
I am importing axios as follows into my typescript project:
import axios from 'axios';
which compiles without a problem, however the resulting javascript code throws an exception.
If I change my import to:
import * as axios from 'axios';
I get a compiler error:
But at least the resulting javascript code runs without issues.
Seems like there's kind of a mismatch here.
Same issue here ;) Works in 1.1.0
but doesn't in 1.1.2
@GabrielModog, yeah, that was the code we had in our codebase (as opposed to what @AuspeXeu has), but the results are the same. I believe something broke between the releases I mentioned.
@GabrielModog that's literally what the first code block in my issue description is ;)
If that's an option for you, a workaround is to enable esModuleInterop.
+1
+1
It doesn't work since v1.0.0 (0.27.2 works fine with the same codebase), importing axios results in an undefined variable. Any idea what to do ?
+1
It doesn't work since v1.0.0 (0.27.2 works fine with the same codebase), importing axios results in an undefined variable. Any idea what to do ?
It works in 1.1.0
, we are using that successfully.
@Enngage how about 1.1.2
?
I am having the same problem with the 1.1.2
and i cannot seem to make it work with 1.0.0
as well.
This seems to have been introduced in 1.1.1
. 1.1.0
is the last working version.
This seems to have been introduced in
1.1.1
.1.1.0
is the last working version.
Indeed, thanks for pointing that out. I have the issue both on 1.0.0
and 1.1.1
. However 1.1.0
is working fine. So do you think the bug may have been introduced, removed and reintroduced ?
@apt-bh yeah this is actually what happened. There is an oddity that has crept in with the build process and until we locked it down we mended common JS as this is by far the widest implementation of the library. I have merged a PR recently that I am going to test and hopefully that solves all issues for us with regard to this. Watch for a v1.1.3
@apt-bh yeah this is actually what happened. There is an oddity that has crept in with the build process and until we locked it down we mended common JS as this is by far the widest implementation of the library. I have merged a PR recently that I am going to test and hopefully that solves all issues for us with regard to this. Watch for a v1.1.3
Thanks for the quick reply, I'll be watching for the new release
I have done testing and this is now working plus the common JS use is working, I will do a release tonight
I just facing the same issue in typescript but I tried use "axios": "^0.27.2",
and working just fine
v1.1.3 still not working
+1
If that's an option for you, a workaround is to enable esModuleInterop.
Solves it for me. Though I had to change the syntax of other imports I have.
Same problem, I had to fall back to 1.1.0
+1
+1 having same issue
Problem persists in 1.1.3 for me
Facing this issue as well on 1.1.3. Any updates on this?