nitrojs / nitrojs/nitro

Cannot override specific hooks once the preset already registered the same hook

Open
#1,382 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Discussed in https://github.com/unjs/nitro/discussions/1376

Originally posted by igorjacauna July 2, 2023
I would like to use the compiled hook but if I use a preset, my hook overwrites the preset hook. So, the preset hook is not called, only my hook configured in nitro.options.hooks.compiled

Repro: https://github.com/igorjacauna/nuxt-nitro-hook
More info about reproduction in README

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction linked in the issue and its README, then trace how nitro.options.hooks.compiled is handled when a preset has already registered that hook. Confirm the current behavior and identify the expected composition where both hooks are called; done means the preset hook and the user-configured hook both run.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.