swagger-api / swagger-api/swagger-ui

Getting TypeError: `s is not a function`after upgrading to v5.11.0

Open
#10,511 17 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Ubuntu 22
  • Browser: Chrome
  • Version: 135.0.7049.114
  • Method of installation: [e.g. npm, dist assets]
  • Swagger-UI version: 5.11.0
  • Swagger/OpenAPI version: N/A
Content & configuration

Swagger-UI configuration options:

SwaggerUI({
  dom_id: "#swagger-ui",
  url: $("base").attr("href") + "api/swagger.yaml",
});
Describe the bug you're encountering

We are trying to upgrade swagger-ui from v4 to v5. It was OK when we upgraded to v5.10.5. But since v5.11.0, there is a type error occurring when we access the page.

It appears the error could be related to React, but our project is a pretty small one which does not use React in any way. We simply use webpack to generate a JS bundle file to be consumed in some html pages.

This is our webpack config.
Image

This is the package.json file.

Image

This is how we use the js bundle file.

Image

To reproduce...

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error
Expected behavior

The page should be correctly displayed.

Screenshots

With 5.11.0:
Image

With 5.10.5:

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the webpack configuration, package.json, and generated JavaScript bundle described in the report; compare dependency and bundling differences between Swagger UI 5.10.5 and 5.11.0. Reproduce the upgrade in the reported Ubuntu/Chrome setup and trace the s is not a function error. Done means the bundled page displays correctly on 5.11.0 without requiring React.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.