Q&A
- Method of installation: yarn add swagger-ui-react
- Swagger-UI version: 3.23.2
Content & configuration
Clean create-react-app project
Describe the bug you're encountering
Cannot compile because of the error with @babel/runtime-corejs2 missing:
Failed to compile.
./node_modules/swagger-ui-react/index.js
Module not found: Can't resolve '@babel/runtime-corejs2/core-js/json/stringify' in 'C:\Users\username\project\node_modules\swagger-ui-react'
To reproduce...
Steps to reproduce the behavior:
- Create a new react project using create-react-app
yarn add swagger-ui-react
import SwaggerUI from "swagger-ui-react";
yarn start
Expected behavior
It can compile with swagger-ui-react 3.23.0
Additional context or thoughts
@babel/runtime-corejs2 apparently is not used in create-react-app projects. So it should be declared as dependencies for swagger-ui-react. Adding it explicitly to package.json is not a common practice.
Q&A
Content & configuration
Clean create-react-app project
Describe the bug you're encountering
Cannot compile because of the error with
@babel/runtime-corejs2missing:To reproduce...
Steps to reproduce the behavior:
yarn add swagger-ui-reactimport SwaggerUI from "swagger-ui-react";yarn startExpected behavior
It can compile with
swagger-ui-react3.23.0Additional context or thoughts
@babel/runtime-corejs2apparently is not used in create-react-app projects. So it should be declared asdependenciesforswagger-ui-react. Adding it explicitly topackage.jsonis not a common practice.