Skip to content

Swagger API documentation is broken in esbuild bundle #2915

@MatsG23

Description

@MatsG23

When I use Fastify in combination with Swagger, the API documentation can not be accessed when running the bundle file by esbuild.

When I run the bundle file, I can see this error in the console:

"root" path "[path to one level above the project folder]/static" must exist

Trying to access the API documentation at http://localhost:3000/documentation then fails with a 404 HTTP error. The documentation thing when I run the unbundled code project.
My guess is that the code in the bundle somehow infers with the @fastify/swagger dynamic documentation generation so that the output path for the Swagger documentation HTML page is incorrect.

You can easily reproduce the issue in this project (further instructions given): https://github.com/MatsG23/esbuild-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions