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
fix(nuxt): allow modules to disable appManifest
without crashing
#24786
Conversation
Run & review this pull request in StackBlitz Codeflow. |
appManifest
without crashingappManifest
without crashing
For the record, I tried to add a test to cover this bug for the future, but I was not sure how exactly the test setup worked and I did not find the time to dive further into it. If this is something you consider worthwile for this PR, I would appreciate some guidance about how to do it. |
Sorry about all the spam - just making a one line change on my phone π |
π Linked issue
experimental.appManifest
in a module breaks the appΒ #24672β Type of change
π Description
Resolves #24672
nuxt.options.experimental.appManifest
is set to true by default, and can be set tofalse
by users if they want to opt out of the app manifest generation feature. However, a user module trying to disableappManifest
would break completely the user app because of the ordering ininitNuxt
(located in packages/nuxt/src/core/nuxt.ts).Before this PR, the
manifest-route-rule
middleware was added before any user module could have the opportunity to setnuxt.options.experimental.appManifest
tofalse
. However, the middleware throws an error if it is registered andappManifest
is not equal totrue
.As a result, when a user module tried to override the Nuxt config to set
nuxt.options.experimental.appManifest
tofalse
, the middleware was still registered in the app but was throwing on every route with a 500 error, thus broking the app.This is why this PR moves the addition of the
manifest-route-rule
middleware after the registration of user hooks : this way, the config can be altered by the user modules before the middleware is added.π Checklist