Skip to content

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

Closed

Description

@igorjacauna

Discussed in #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

Activity

  1. added
    bug
    good first issue
    and removed
    bug
    on Jul 3, 2023
  2. Hebilicious commented on Jul 3, 2023

    @Hebilicious
    Contributor

    I can confirm that this behaviour happens on my end too.
    Adding a custom "compiled" hook overwrite the preset one. I'm not sure if this intended.

  3. igorjacauna commented on Jul 3, 2023

    @igorjacauna
    ContributorAuthor

    Thanks for help!

    I don't known if this should be something to discuss in unjs/hookable also or it's only about how Nitro handle this hooks with hookable.

  4. added
    bug
    on Jul 3, 2023
  5. pi0 commented on Jul 3, 2023

    @pi0
    Member

    Hi. This is an internal limitation with Nitro config merging only. Hookable even has utils for this. The fix should be straightforward but since some presets currently shadow their base preset hooks, this should be handled with extra care.

  6. changed the title [-]Is it possible to use specific nitro hooks once the preset already registered the same hook?[/-] [+]Cannot override specific hooks once the preset already registered the same hook[/+] on Jul 3, 2023
  7. removed
    good first issue
    on Jul 3, 2023
  8. added and removed on Oct 17, 2026
  9. added theissue type on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions