Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
igorjacauna opened this issue Jul 3, 2023 Discussed in #1376 · 3 comments
Open
Labels
bug Something isn't working

Comments

@igorjacauna
Copy link
Contributor

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

@Hebilicious Hebilicious added bug Something isn't working good first issue Good for newcomers question Further information is requested and removed bug Something isn't working labels Jul 3, 2023
@Hebilicious
Copy link
Member

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.

@igorjacauna
Copy link
Contributor Author

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.

@pi0 pi0 added the bug Something isn't working label Jul 3, 2023
@pi0
Copy link
Member

pi0 commented Jul 3, 2023

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.

@pi0 pi0 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 Jul 3, 2023
@pi0 pi0 removed good first issue Good for newcomers question Further information is requested labels Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants