Uncaught ReferenceError: require is not defined, Uncaught ReferenceError: SwaggerUIBundle is not defined
See original GitHub issueUsing npm package 3.0.9, nothing works as documented.
- There is no index.html in dist/
- Using the index.html from master as starting point, there is no wagger-ui-bundle.js in dist/ neither
- Using the wagger-ui.js from dist/, I get the following errors:
Uncaught ReferenceError: require is not defined
Uncaught ReferenceError: SwaggerUIBundle is not defined
- 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:
- Created 6 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@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
Hi @shockey: Thank you for pointing me to
swagger-ui-dist. It will indeed suit my needs.