We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
7.8.0
18.20
windows 11
E:\git_code\trade\openapi-ts\node_modules.pnpm\[email protected][email protected]\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\[email protected]\node_modules\parse-json\index.js from E:\git_code\trade\openapi-ts\node_modules.pnpm\[email protected][email protected]\node_modules\openapi-typescript\dist\lib\redoc.cjs not supported.\r
when use "require": "./dist/index.cjs", will see Error [ERR_REQUIRE_ESM] because parse-json not supporting cjs!
no Error [ERR_REQUIRE_ESM]
npx @redocly/cli@latest lint
The text was updated successfully, but these errors were encountered:
run: pnpm vitest run test/cjs.test.js Unit testing in the project did not pass,
E:\git_code\liangskyli\openapi-typescript\packages\openapi-typescript>pnpm vitest run test/cjs.test.js RUN v3.1.4 E:/git_code/liangskyli/openapi-typescript/packages/openapi-typescript ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ FAIL test/cjs.test.js [ test/cjs.test.js ] Error: require() of ES Module E:\git_code\liangskyli\openapi-typescript\node_modules\.pnpm\[email protected]\node_modules\parse-json\index.js from E:\git_code\liangskyli\openapi-typescript\packages\openapi-typescript\dist\lib\redoc.cjs not supported. Instead change the require of index.js in E:\git_code\liangskyli\openapi-typescript\packages\openapi-typescript\dist\lib\redoc.cjs to a dynamic import() which is available in all CommonJS modules. ❯ Object.<anonymous> dist/lib/redoc.cjs:7:19 ❯ Object.<anonymous> dist/index.cjs:7:15 ❯ test/cjs.test.js:3:45 1| // important: MUST use require()! 2| const { fileURLToPath } = require("node:url"); 3| const { astToString, default: openapiTS } = require("../dist/index.cjs"); | ^ 4| 5| const TIMEOUT = 10_000; ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ Test Files 1 failed (1) Tests no tests Start at 15:18:26 Duration 715ms (transform 28ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 137ms)
Sorry, something went wrong.
[email protected] is ok, build file:
// src/lib/redoc.ts var import_openapi_core = require("@redocly/openapi-core"); var import_node_perf_hooks = require("node:perf_hooks"); var import_node_stream = require("node:stream"); var import_node_url = require("node:url"); // ../../node_modules/.pnpm/[email protected]/node_modules/parse-json/index.js var import_code_frame = __toESM(require_lib2(), 1);
errror in #2310 use unbuild build cjs, I did not find that Unbuild can be configured to adapt to builds that only support ES packages
build file:
'use strict'; const openapiCore = require('@redocly/openapi-core'); const node_perf_hooks = require('node:perf_hooks'); const node_stream = require('node:stream'); const node_url = require('node:url'); const parseJson = require('parse-json'); const utils = require('./utils.cjs');
const parseJson = require('parse-json'); ----- build error in here
No branches or pull requests
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\[email protected][email protected]\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\[email protected]\node_modules\parse-json\index.js from E:\git_code\trade\openapi-ts\node_modules.pnpm\[email protected][email protected]\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
npx @redocly/cli@latest lint
)Extra
The text was updated successfully, but these errors were encountered: