Undici v6 imported by @nuxt/scripts since v1.3.4
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 584
- Forks
- 91
- Avg merge
- 1d 36m
- Merged PRs (30d)
- 29
Description
Undici v6 is imported by @nuxt/scripts since v1.3.4 at least up to v1.3.8.
In our case, it conflicts in some hidden way with our own import of undici v8, causing our nitro plugin for enabling the cache (inexistent in v6) to fail, failing our startup, but only on actual servers, not in dev mode.
import { setGlobalDispatcher, Agent, interceptors } from 'undici';
export default defineNitroPlugin(() => {
setGlobalDispatcher(new Agent().compose(interceptors.cache()));
});
=>
Application has thrown an uncaught exception and is terminated:
TypeError: interceptors.cache is not a function
at file:///D:/frontend/server/chunks/_/nitro.mjs:8221:18
at runNitroPlugins (file:///D:/XVRT/frontend/server/chunks/_/nitro.mjs:18122:7)
at file:///D:/frontend/server/chunks/_/nitro.mjs:18133:1
at ModuleJob.run (node:internal/modules/esm/module_job:439:25)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async node:internal/modules/esm/loader:643:26
Workaround: add a package override to force undici v8 to be picked-up.
It seems a few PR have been done to cease bringing Undici through @nuxt/scripts, like #860 and #870. Is it possible to remove it entirely from @nuxt/scripts?
(I have tried a repro on Stackblitz, but I have been unable to repro on it or on a dev workstation.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the @nuxt/scripts dependency setup and related PRs #860 and #870 to determine where Undici v6 is still brought in. Confirm that the dependency is removed without breaking @nuxt/scripts, and verify that a production Nuxt server can use Undici v8 without the interceptors.cache error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, nuxtjs, typescript
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100