Open MikeMcC399 opened 2 weeks ago
v7.0.0
when running tests for this package/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:851
return old(m, filename);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/raymo/projects/cypress/packages/rewriter/node_modules/parse5-html-rewriting-stream/dist/index.js from /Users/raymo/projects/cypress/packages/rewriter/lib/html.ts not supported.
Instead change the require of index.js in /Users/raymo/projects/cypress/packages/rewriter/lib/html.ts to a dynamic import() which is available in all CommonJS modules.
at require.extensions.<computed> [as .js] (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:851:20)
at Object.<anonymous> (/Users/raymo/projects/cypress/packages/rewriter/lib/html.ts:5:40)
at m._compile (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:857:29)
at require.extensions.<computed> [as .ts] (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:859:16)
at Object.<anonymous> (/Users/raymo/projects/cypress/packages/rewriter/test/unit/html-spec.ts:5:16)
at m._compile (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:857:29)
at require.extensions.<computed> [as .ts] (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:859:16)
at /Users/raymo/projects/cypress/node_modules/mocha/lib/mocha.js:231:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/Users/raymo/projects/cypress/node_modules/mocha/lib/mocha.js:228:14)
at Mocha.run (/Users/raymo/projects/cypress/node_modules/mocha/lib/mocha.js:514:10)
at Object.<anonymous> (/Users/raymo/projects/cypress/node_modules/mocha/bin/_mocha:480:18) {
code: 'ERR_REQUIRE_ESM'
ts-node
seems to require them under the hood.tsconfig.json
in that package based on the recommended way through ts-node
here, along with a host of other variations. Nothing seemed to work. The recommendation from ts-node
is to either try those configurations, downgrade the package to a version that uses CommonJS, or convert your code to strictly use CommonJS or ESM.I just don't have a good idea of how to get this to work.
What would you like?
Why is this needed?
The npm module @types/parse5-html-rewriting-stream is deprecated. The release information for parse5@v7.0.0 shows that
types
were added in this feature release in November 2022. The Breaking: TypeScript section includes the text:Other
Where used:
"@types/parse5-html-rewriting-stream": "5.1.1"
"parse5-html-rewriting-stream": "5.1.1"
latest
is currently7.0.0