swagger-api / swagger-api/swagger-ui
Cannot render content when build with Vite or Rollup
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: MacOS
- Browser: Chrome
- Version: 97
- Method of installation: pnpm
- swagger-ui-react version: 4.1.3
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
Content & configuration
Swagger-UI configuration options:
export const App = () => {
const requestInterceptor = useCallback((req) => {
req['headers']['Authorization'] = localStorage.getItem('accessToken');
return req;
}, []);
return <SwaggerUI requestInterceptor={requestInterceptor} url={'/v1/openapi'} docExpansion={'list'} />;
};
Describe the bug you're encountering
You are using the package https://github.com/medikoo/memoizee.
This is known to have build-issues when used with the Builder "Rollup". "Vite" is using "Rollup".
I tracked the rendering issue from the screenshots down to that library.
Expected behavior
Screenshots
Additional context or thoughts
My recommendation: You should replace that library by something more mature or a less fancy own implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the swagger-ui-react rendering failure with the shown requestInterceptor configuration under Vite or Rollup, then inspect the memoizee dependency implicated in the report. Done means Swagger UI renders its content successfully in the affected build setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rollup, vite
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100