Uh oh!
There was an error while loading. Please reload this page.
perf(nuxt)!: remove legacy app context - #5630
Conversation
✅ Deploy Preview for nuxt3-docs canceled.
|
pi0
commented
Jun 27, 2022
Do you have a benchmark of prod bundle size impact and percentage savings? It is considerably large, I see no reason to even keep backward-compatible code into the final release. |
danielroe
commented
Jun 27, 2022
This PR will mean by default this plugin is not included in the bundle. The impact was ~4/92 kB of uncompressed JS (saving approx 4%). Worth mentioning that previously because the components plugin was not wrapped in defineNuxtPlugin, by default the legacy app plugin was always running. |
pi0
commented
Jun 27, 2022
Then let's remove it as soon as possible to avoid misleading behavior. 4.5Kb is considerable (although gzip is probably much less in entry bundle). I initially added it for vue devtool and with intention of supporting Nuxt 2 compatible modules injecting a plugin but today it seems we need to migrate them anyway. It wouldn't worth to continue experimenting... |
danielroe
commented
Jun 27, 2022
Sounds good to me! Will update 👍 |
danielroe
commented
Jun 27, 2022
Note to self: an example of a plugin that does require this is https://github.com/moritzsternemann/vue-plausible/blob/main/src/nuxt-plugin.ts. |
🔗 Linked issue
resolvesnuxt/nuxt#14002
❓ Type of change
📚 Description
We are currently including a legacy plugin that creates a proxy converting the Nuxt 3 app interface to a Nuxt 2 compatible context. This is probably not needed in majority of new apps, but it is still included in bundle.
This PR completely removes the legacy context feature.
👉 Migration
If you are using plugins (perhaps injected by a module) that are relying on the Nuxt 2 format of
(context, inject) => voidthen it needs to be updated to the new Nuxt 3 format of(nuxtApp) => void: https://v3.nuxtjs.org/guide/directory-structure/plugins#creating-pluginsMoreover, if you are relying on the globally available legacy-format
window.$nuxtyou will need to inject it yourself.📝 Checklist