I have a react component that uses axios 1.6.2 And it has these line:
import axios from "axios";
export const makeAxiosCall = () => {
let axiosInstance = axios.create(......);
//Make axios call
}
When I test this using yarn storybook, axios works fine and makes an API call.
In my package.json scripts section, I have this line: "transpile": "./node_modules/.bin/babel src -d dist --copy-files --ignore src/**/*.stories.js ",
Once I do: yarn transpile
And use this component in my Main component, I got an error when it tries to make an API call:
Error: _axios.default.create is not a function
And when I observe the value of _axios in the browser console, I saw this:
_axios { default: '/static/media/axios.7a2137e03d7017b9607.cjs' }
That is why I got the above error. I didn't see this error in axios 0.26.0 but 1.6.2 Any suggestions to fix this?