Skip to content

cjs format error in openapi-typescript@7.8.0 #2342

Open
@liangskyli

Description

@liangskyli

openapi-typescript version

7.8.0

Node.js version

18.20

OS + version

windows 11

Description

E:\git_code\trade\openapi-ts\node_modules.pnpm\openapi-typescript@7.8.0_typescript@5.5.4\node_modules\openapi-typescript\dist\lib\redoc.cjs:7\r
const parseJson = require('parse-json');\r
^\r
\r
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\git_code\trade\openapi-ts\node_modules.pnpm\parse-json@8.3.0\node_modules\parse-json\index.js from E:\git_code\trade\openapi-ts\node_modules.pnpm\openapi-typescript@7.8.0_typescript@5.5.4\node_modules\openapi-typescript\dist\lib\redoc.cjs not supported.\r

Reproduction

when use "require": "./dist/index.cjs", will see Error [ERR_REQUIRE_ESM]
because parse-json not supporting cjs!

Expected result

no Error [ERR_REQUIRE_ESM]

Required

  • My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-tsRelevant to the openapi-typescript library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions