{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1551","labels_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1551/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1551/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1551/events","html_url":"https://github.com/swagger-api/swagger-ui/issues/1551","id":102055028,"number":1551,"title":"ReferenceError: Handlebars is not defined","user":{"login":"RaviVaranasi","id":51507,"avatar_url":"https://avatars.githubusercontent.com/u/51507?v=3","gravatar_id":"","url":"https://api.github.com/users/RaviVaranasi","html_url":"https://github.com/RaviVaranasi","followers_url":"https://api.github.com/users/RaviVaranasi/followers","following_url":"https://api.github.com/users/RaviVaranasi/following{/other_user}","gists_url":"https://api.github.com/users/RaviVaranasi/gists{/gist_id}","starred_url":"https://api.github.com/users/RaviVaranasi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaviVaranasi/subscriptions","organizations_url":"https://api.github.com/users/RaviVaranasi/orgs","repos_url":"https://api.github.com/users/RaviVaranasi/repos","events_url":"https://api.github.com/users/RaviVaranasi/events{/privacy}","received_events_url":"https://api.github.com/users/RaviVaranasi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-20T04:02:25Z","updated_at":"2015-09-10T05:44:46Z","closed_at":null,"body":"Trying to generate documentation for endpoint from my api-docs.json definition.\r\n\r\nAm i missing something or setting up swagger ui incorrectly ?\r\n\r\nBelow is the exception \r\n```\r\nthis[\"Handlebars\"][\"templates\"][\"apikey_button_view\"] = Handlebars.template({\"\r\n                                                        ^\r\nReferenceError: Handlebars is not defined\r\n  at Object.<anonymous> (/app/node_modules/swagger-ui/dist/swagger-ui.js:9:57)\r\n  at Object.<anonymous> (app/node_modules/swagger-ui/dist/swagger-ui.js:32183:7)\r\n```\r\nexpress controller below:\r\n\r\n```\r\nimport Handlebars from 'handlebars';\r\nimport SwaggerUi from 'swagger-ui';\r\n\r\nvar app = express();\r\n\r\nlet swaggerUi = new SwaggerUi({\r\n  url:'/api-docs.json'\r\n});\r\nswaggerUi.load();\r\n\r\n\r\n// Serve up swagger ui at /docs via static route\r\nvar docs_handler = express.static(__dirname + '../../node_modules/swagger-ui/');\r\napp.get(/^\\/docs(\\/.*)?$/, function(req, res, next) {\r\n\tif (req.url === '/docs') { // express static barfs on root url w/o trailing slash\r\n    res.writeHead(302, { 'Location' : req.url + '/' });\r\n    res.end();\r\n    return;\r\n  }\r\n  // take off leading /docs so that connect locates file correctly\r\n  req.url = req.url.substr('/docs'.length);\r\n  return docs_handler(req, res, next);\r\n});\r\napp.get('/api-docs', (req, res) => {\r\n\tres.json(swaggerJsonConfig);\r\n});\r\n\r\nexport default app;\r\n```"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/comments/139123174","html_url":"https://github.com/swagger-api/swagger-ui/issues/1551#issuecomment-139123174","issue_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/1551","id":139123174,"user":{"login":"NiveditN","id":11422270,"avatar_url":"https://avatars.githubusercontent.com/u/11422270?v=3","gravatar_id":"","url":"https://api.github.com/users/NiveditN","html_url":"https://github.com/NiveditN","followers_url":"https://api.github.com/users/NiveditN/followers","following_url":"https://api.github.com/users/NiveditN/following{/other_user}","gists_url":"https://api.github.com/users/NiveditN/gists{/gist_id}","starred_url":"https://api.github.com/users/NiveditN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiveditN/subscriptions","organizations_url":"https://api.github.com/users/NiveditN/orgs","repos_url":"https://api.github.com/users/NiveditN/repos","events_url":"https://api.github.com/users/NiveditN/events{/privacy}","received_events_url":"https://api.github.com/users/NiveditN/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T05:44:46Z","updated_at":"2015-09-10T05:44:46Z","body":"Hi, have you tried importing the modules in ES5 way? \r\n`var Handlebars = require('handlebars');`\r\nDoes that change anything?"}}