nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.28k stars 253 forks source link

nuxt-image + glob v9.0 break build #1383

Closed maestroosram closed 1 week ago

maestroosram commented 1 week ago

I overrided the default dependency of glob to ^9.0.0 in order to get rid of inflight which has been marked as unsopported as it leaks memory.

When doing so, if nuxt-image is loaded as a module the default node-server build fails with this error: [nitro] ERROR Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit: (node-externals) buildEnd Simply commenting out '@nuxt/image' from the modules in the nuxt.config fixes the issue.

If using a different nitro preset (like 'cloudflare-pages') the build succedes.

package.json { "name": "nss-nuxt", "private": true, "scripts": { "build": "nuxt build", "dev": "nuxt dev", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" }, "devDependencies": { "@nuxt/image": "^1.7.0", "@nuxtjs/i18n": "^8.0.0", "@pinia-plugin-persistedstate/nuxt": "^1.2.0", "nuxt": "^3.11.2", "nuxt-delay-hydration": "^1.3.3", "nuxt-gtag": "^2.0.5", "sass": "^1.64.2" }, "overrides": { "vue": "latest", "glob": "^9.0.0" }, "dependencies": { "@gtm-support/vue-gtm": "^2.2.0", "@nuxtjs/device": "^3.1.1", "@pinia/nuxt": "^0.5.1", "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.3", "nuxt-jsonld": "^2.0.8", "nuxt-swiper": "^1.2.2", "pinia": "^2.1.6" } }

danielroe commented 1 week ago

glob is not used directly by @nuxt/image. Would you provide a reproduction?

github-actions[bot] commented 1 week ago

Would you be able to provide a reproduction? 🙏

More info ### Why do I need to provide a reproduction? Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. ### What will happen? If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect. If `needs reproduction` labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it. ### How can I create a reproduction? We have a template for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/image/tree/main/example A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as **minimal** as possible. See more details [in our guide](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction). You might also find these other articles interesting and/or helpful: - [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required) - [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve)
maestroosram commented 1 week ago

Hi, here a reproduction: https://stackblitz.com/edit/github-jjft2q?file=package.json If you run npm run build you will see the error. glob is a direct dependancy of nuxt -> nuxt devtools - but the default 8.0.0 requires inflight which is now unsupported, so forcing to the 9.0.0. creates the error in build.

danielroe commented 1 week ago

It is not a direct dependency of @nuxt/devtools though it is a dependency of @npmcli/package-json which is a dependency of pacote which is used in @nuxt/devtools. (But it is not v8 which is the version depended upon, but v10.)

Investigating, it seems v8 is required by nitro, via its dependency on @rollup/plugin-commonjs. I would suggest you raise the issue on @rollup/plugin-commonjs instead 🙏