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

Unable to use swagger-ui-react #9951

Open
andresf01 opened this issue Sep 12, 2024 · 0 comments
Open

Unable to use swagger-ui-react #9951

andresf01 opened this issue Sep 12, 2024 · 0 comments

Comments

@andresf01
Copy link

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

package.json

{
  "name": "swagger-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "parcel src/index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "buffer": "^5.5.0||^6.0.0",
    "parcel": "^2.12.0",
    "process": "^0.11.10"
  },
  "dependencies": {
    "react": "17",
    "react-dom": "17",
    "swagger-ui-react": "^5.17.14"
  },
  "@parcel/resolver-default": {
    "packageExports": true
  }
}

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script type="module" src="index.tsx"></script>
  </body>
</html>

index.tsx

import React from "react";
import ReactDOM from "react-dom";
import SwaggerUI from "swagger-ui-react";

ReactDOM.render(
  <React.StrictMode>
    <SwaggerUI url="https://petstore.swagger.io/v2/swagger.json" />
  </React.StrictMode>,
  document.getElementById("root")
);

🤔 Expected Behavior

Render a SwaggerUI component.

😯 Current Behavior

image

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel ^2.12.0
Node ^18/^20
pnpm 8.15.7
Operating System macOS Sonoma
react ^17
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

1 participant