Related discussion in PR on Swagger UI repo: swagger-api/swagger-ui#7898
Installing and using swagger-ui-react
fails out of the box on applications
that use Vite.js. Why?
This repo is a minimal reproduction of those issues.
npm create vite@latest swagger-ui-on-vite
- Pick "react" and "react-ts"
- For a dev build, run
npm run dev
- Remove default stuff main.tsx - and styling
npm install --save swagger-ui-react @types/swagger-ui-react
- Import and use the
SwaggerUI
component - Observe errors when opening the app: