Open CharlesOnAir opened 1 year ago
up, I face the same error.
in my case it works while i am still coding with typescript, but after i transpile the code to javascript to a folder dist/
, the swagger simply doesn't work anymore.
Same here. It works when I bundle my project with tsup, but fails with esbuild. Can probably provide some more information if needed to debug this. I believe it's probably an issue with the bundler and not the library itself.
this package uses swagger-ui-dist which contains the static UI assets (CSS & JS)
it serves those assets directly from inside the node_modules using the method getAbsoluteFSPath
exported by swagger-ui-dist
so you may face issues during bundling as these assets aren't explicitly imported, hence the 404 issues (@joaocasarin)
pnpm install -D swagger-ui-dist
import { copy } from 'esbuild-plugin-copy';
copy({
assets: [
{
from: ['./node_modules/swagger-ui-dist/swagger-ui-bundle.js'],
to: 'SwaggerUIBundle.js',
},
{
from: ['./node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js'],
to: 'SwaggerUIStandalonePreset.js',
},
],
}),