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

`[email protected]` dependency causes ES module resolution errors in Nuxt/Nitro builds

Open aveliino88 opened this issue 5 months ago • 2 comments

Description: The latest version of isomorphic-dompurify (2.27.0) pulls in [email protected], which transitively includes [email protected]. This version of lru-cache has ES module resolution issues in Nuxt/Nitro production builds.

Error: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/.output/server/node_modules/lru-cache/dist/esm/index.js' Did you mean to import "file:///app/.output/server/node_modules/.nitro/[email protected]/dist/commonjs/index.js"?

Environment:

  • Node.js: 22
  • Nuxt: 4.1.2
  • Build environment: Docker
  • isomorphic-dompurify: 2.27.0

Dependency Chain: [email protected] └── [email protected] └── [email protected] └── @asamuzakjp/[email protected] └── [email protected]

Workaround: Adding "lru-cache": "^10.4.3" to package.json overrides fixes the issue.

aveliino88 avatar Sep 17 '25 06:09 aveliino88

Having a similar issue when upgrading to [email protected]. In my case next build fails with the following error:

#14 326.4    Collecting page data ...
#14 329.0 Error: ENOENT: no such file or directory, open '/app/.next/browser/default-stylesheet.css'
#14 329.0     at 601485 (.next/server/chunks/3602.js:306:180317)
#14 329.0     at c (.next/server/webpack-runtime.js:1:143)
#14 329.0     at 378547 (.next/server/chunks/3602.js:276:225173)
#14 329.0     at c (.next/server/webpack-runtime.js:1:143)
#14 329.0     at 448184 (.next/server/chunks/3602.js:281:426390)
#14 329.0     at c (.next/server/webpack-runtime.js:1:143)
#14 329.0     at 336287 (.next/server/chunks/3602.js:260:26600)
#14 329.0     at c (.next/server/webpack-runtime.js:1:143)
#14 329.0     at 322625 (.next/server/chunks/3602.js:252:213408) {
#14 329.0   errno: -2,
#14 329.0   code: 'ENOENT',
#14 329.0   syscall: 'open',
#14 329.0   path: '/app/.next/browser/default-stylesheet.css'
#14 329.0 }
#14 329.0 
#14 329.0 > Build error occurred
#14 329.0 [Error: Failed to collect page data for /api/[...slug]] {
#14 329.0   type: 'Error'
#14 329.0 }

Downgrading to v2.26.0 completely fixes the issue.

simovicaleksa avatar Sep 18 '25 08:09 simovicaleksa

Thanks everyone for reporting.

I've updated dompurify dependency to the latest in the latest release but it won't probably help with this issue.

I think it's better to report it to the main dompurify project as well because isomorphic-dompurify is just a thin wrapper around it.

kkomelin avatar Sep 18 '25 12:09 kkomelin

Please help testing 3.0.0-rc.2 which is aimed to fix this issue.

kkomelin avatar Feb 07 '26 12:02 kkomelin