Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwaggerUIBundle is not defined with webpack build #176

Closed
ahmednkhan24 opened this issue Apr 21, 2020 · 3 comments
Closed

SwaggerUIBundle is not defined with webpack build #176

ahmednkhan24 opened this issue Apr 21, 2020 · 3 comments

Comments

@ahmednkhan24
Copy link

ahmednkhan24 commented Apr 21, 2020

I am creating a Node.js Express API found here.

I am trying to incorporate swagger-ui-express into my application. I am able to successfully load the localhost:5000/api-docs page when running locally.
I am using webpack to create a "production" build. When I create the bundle and try to run it locally, I can not access the localhost:5000/api-docs page anymore.

This is the error that is seen in the console:

Uncaught SyntaxError: Unexpected token ':'
swagger-ui-standalone-preset.js:1 Uncaught SyntaxError: Unexpected token ':'
swagger-ui-init.js:140 Uncaught ReferenceError: SwaggerUIBundle is not defined
    at window.onload (swagger-ui-init.js:140)

This is where I am serving swagger-ui-express.
And this is where I am defining the swagger.json file.

@scottie1984
Copy link
Owner

For webpack try the following #90 (comment)

I will add to the readme if it works for you.

@ahmednkhan24
Copy link
Author

I tried that, but it didn't work. This solution is what's working for me.

@NoodleOfDeath
Copy link

NoodleOfDeath commented Mar 24, 2023

how is this considered completed? the work around is like a hack... can this library be rewritten to work for production environments? this runs fine as an express node, but after being webpacked with esbuild i get this same error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants