question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught ReferenceError: require is not defined, Uncaught ReferenceError: SwaggerUIBundle is not defined

See original GitHub issue

Using npm package 3.0.9, nothing works as documented.

  1. There is no index.html in dist/
  2. Using the index.html from master as starting point, there is no wagger-ui-bundle.js in dist/ neither
  3. Using the wagger-ui.js from dist/, I get the following errors:

Uncaught ReferenceError: require is not defined

Uncaught ReferenceError: SwaggerUIBundle is not defined

  1. There are also errors because the favicons are not in dist/ but well I don’t really care about those.

Basically swagger-ui is unusable as packaged/documented. Not sure what one is supposed to do, I’d rather not have to clone the repo to make it works…

Personally ideally, I’d like a standalone (i.e. with dynamic fetching of the spec) available which seems like it was supposed to be the case reading the release notes

Distribution files & usage Swagger-UI places four distribution files in its dist folder, along with a sourcemap (.map) for each file:

  • swagger-ui.js: Swagger-UI’s core code without any dependencies.
  • swagger-ui.css: Swagger-UI’s styling.
  • swagger-ui-bundle.js: Swagger-UI’s core code, with all dependencies included.
  • swagger-ui-standalone-preset.js: A preset that provides the default StandaloneLayout for Swagger-UI. You’ll want to include this unless you’re creating your own layout file. There’s also an index.html file in the dist folder that can be opened directly, if you want to quickly get started with using Swagger-UI.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
shockeycommented, Jun 22, 2017

@jtblin, @dylancwood was kind enough to add a message to the top of our main README a couple weeks back, so there’s a message there now: https://github.com/swagger-api/swagger-ui/pull/3210

1reaction
dylancwoodcommented, Jun 8, 2017

Hi @shockey: Thank you for pointing me to swagger-ui-dist. It will indeed suit my needs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: SwaggerUIBundle is not defined at ...
I faced the same "SwaggerUIBundle is not defined" with a blank page. Also the problem only on server and not local.
Read more >
A brand new website interface for an even better experience!
Uncaught ReferenceError : require is not defined, Uncaught ReferenceError: SwaggerUIBundle is not defined.
Read more >
electron 5.0.0 "Uncaught ReferenceError: require is not defined"
JavaScript : electron 5.0.0 " Uncaught ReferenceError : require is not defined " [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >
Installation - Swagger Documentation
SwaggerUIBundle is equivalent to SwaggerUI . Docker. You can pull a pre-built docker image of the swagger-ui directly from Docker Hub: docker pull ......
Read more >
ReferenceError: require is not defined (on my rest api)-Reactjs
[Solved]-ReferenceError: require is not defined (on my rest api)-Reactjs. Search. score:0. Accepted answer. const routes = [ ... ]; export { routes };....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found