← All tasks
javascriptjsdom/jsdom #3959Not a task: already works

Error [ERR_REQUIRE_ESM] on require() after updating to jsdom@27.0.1

envgap__jsdom__jsdom-3959

01 / FAILURE SIGNATURE

As reported upstream

Error [ERR_REQUIRE_ESM]: require() of ES Module /var/www/node/jsdomtest/node_modules/parse5/dist/index.js from /var/www/node/jsdomtest/node_modules/jsdom/lib/jsdom/browser/parser/html.js not supported.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
819ff520e37a129b5dd69a744903dbfee776f21d
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

jsdom/jsdom #3959 · read the original issue
### Node.js version

v20.18.1

### jsdom version

27.0.1

### Minimal reproduction case

```js
const { JSDOM } = require("jsdom");

const window = new JSDOM('').window;
```

### How does similar code behave in browsers?

Doesn't even load running node command in console. Console output below from code above


"/var/www/node/jsdomtest/node_modules/jsdom/lib/jsdom/browser/parser/html.js:3
const parse5 = require("parse5");
               ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /var/www/node/jsdomtest/node_modules/parse5/dist/index.js from /var/www/node/jsdomtest/node_modules/jsdom/lib/jsdom/browser/parser/html.js not supported.
Instead change the require of index.js in /var/www/node/jsdomtest/node_modules/jsdom/lib/jsdom/browser/parser/html.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/var/www/node/jsdomtest/node_modules/jsdom/lib/jsdom/browser/parser/html.js:3:16) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.18.1"

### What is the problem?

Upgrading from 27.0.0 to 27.0.1 causes the module to break on loading
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]