openapistack / openapi-client-axios

JavaScript client library for consuming OpenAPI-enabled APIs with axios
https://openapistack.co
MIT License
535 stars 67 forks source link

TypeError: import_openapi_client_axios.default is not a constructor #154

Closed ken-playerlync closed 1 year ago

ken-playerlync commented 1 year ago

Project I am working is in in vite + vue3 + typescript.

I am creating a utilities library that future microfront-ends in my organization can leverage. This includes the OpenAPIAxiosClient. I provide this via a class in the utilities library. I have had no issues in previous POCs leveraging the OpenAPIAxiosClient in a typescript project.

I am wondering if 1) the issue is due to another Axios client that is instantiated in the same app 2) the fact that I return the OpenAPIAxiosClient instance from another class that itself is instantiated as a wrapper for the consuming app to call and retrieve the OpenAPIAxiosClient it spins up (I do this because our APIs can be used for web and native devices and authentication is different but the API endpoints and schemas are the same swagger definitions).

I use rollup to bundle the utilities library I mentioned.

ken-playerlync commented 1 year ago

Discovered the issue only happens when I install my package from the repo, it does not happen when I install the package via a file path from my package.json .... "my-package-with-openapi-client": "../../path/to/project";

ken-playerlync commented 1 year ago

Solved, documentation is misleading, as for some reason the object OpenApiClientAxios is not the default export. But solved by changing to import { OpenAPIClientAxios } from 'openapi-client-axios';