isomorphic-dompurify icon indicating copy to clipboard operation
isomorphic-dompurify copied to clipboard

Updating to `2.31.0` will cause issues when deployed to Vercel

Open ieedan opened this issue 3 months ago • 1 comments

Weirdly this works completely fine locally it's not until you deploy it that it causes issues.

Not sure exactly what the root of the issue is here but it comes from the bumped version of jsdom. Downgrading fixes it for me.

Here is the error I am getting:

Unhandled Rejection: Error [ERR_REQUIRE_ESM]: require() of ES Module /var/task/node_modules/.pnpm/[email protected]/node_modules/parse5/dist/index.js from /var/task/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/browser/parser/html.js not supported.
Instead change the require of index.js in /var/task/node_modules/.pnpm/[email protected]/node_modules/jsdom/lib/jsdom/browser/parser/html.js to a dynamic import() which is available in all CommonJS modules.
    at /opt/rust/nodejs.js:2:13528
    at Function.Gr (/opt/rust/nodejs.js:2:13906)
    at Ue.e.<computed>.Be._load (/opt/rust/nodejs.js:2:13498)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)

ieedan avatar Nov 07 '25 18:11 ieedan

Thanks for reporting @ieedan. It's a well-known issue. Check out this one for possible solutions https://github.com/jsdom/jsdom/pull/3963 Basically, make sure that your Node version is the latest minor/patch release of your major one. Something like:

"node": "^20.19.5 || ^22.21.0 || >=24.10.0"

kkomelin avatar Nov 07 '25 19:11 kkomelin