Skip to content

swagger-ui-react: Module not found: Can't resolve '@babel/runtime-corejs2'... #5505

@robertying

Description

@robertying

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:

  1. Create a new react project using create-react-app
  2. yarn add swagger-ui-react
  3. import SwaggerUI from "swagger-ui-react";
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions