Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

perf(nuxt)!: remove legacy app context - #5630

Merged
pi0 merged 5 commits into
mainfrom
fix/legacy-app
Jul 6, 2022
Merged

perf(nuxt)!: remove legacy app context#5630
pi0 merged 5 commits into
mainfrom
fix/legacy-app

Conversation

@danielroe

@danielroedanielroe commented Jun 27, 2022

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#14002

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to 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) => void then it needs to be updated to the new Nuxt 3 format of (nuxtApp) => void: https://v3.nuxtjs.org/guide/directory-structure/plugins#creating-plugins

Moreover, if you are relying on the globally available legacy-format window.$nuxt you will need to inject it yourself.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Jun 27, 2022
@danielroe
danielroe requested a review from pi0June 27, 2022 10:27
@danielroedanielroe self-assigned this Jun 27, 2022
@netlify

netlifyBot commented Jun 27, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit7fca057
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62c36bbc8d3e8a000942a83b

@pi0

pi0 commented Jun 27, 2022

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
MemberAuthor

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

pi0 commented Jun 27, 2022

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
MemberAuthor

Sounds good to me! Will update 👍

@danielroe

Copy link
Copy Markdown
MemberAuthor

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.

@danielroedanielroe changed the title perf(nuxt)!: require explicit opt-in for legacy app context normalizationperf(nuxt)!: remove legacy app contextJul 4, 2022
pi0
pi0 approved these changes Jul 6, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xenhancementNew feature or request🍰 p2-nice-to-havePriority 2: nothing is broken but it's worth addressing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce compatibility layer via feature flag

2 participants

@danielroe@pi0