Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt)!: use parser to generate page metadata #8536

Merged
merged 7 commits into from Nov 2, 2022
Merged

fix(nuxt)!: use parser to generate page metadata #8536

merged 7 commits into from Nov 2, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Oct 27, 2022

πŸ”— Linked issue

resolves nuxt/nuxt#15115, resolves nuxt/framework#8059, resolves nuxt/nuxt#12919, resolves nuxt/nuxt#14483, resolves nuxt/nuxt#15282, resolves nuxt/nuxt#14650, resolves nuxt/nuxt#14742

related nuxt/nuxt#14584

❓ 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

This PR reworks the implementation of definePageMeta to use the built-in parser, and complete overwrite the source file. The previous implementation was causing vite + webpack to mark any imports into the page as dependencies of the metadata, which meant that (in development) vite initial load was sigificantly affected negatively. And in production, both bundlers were rendering far too many prefetches into the HTML.

In comparison, in just our test fixture, this PR reduces:

  • network requests from 40 -> 30
  • total transferred from 224kB -> 179kB
  • total resources from 187kB -> 167kB

πŸ‘‰ Breaking changes

As we are parsing now, a more expensive operation, we now restrict transforms. Only pages within a pages directory (or a layer's pages directory) are scanned for page metadata. If a user is adding a page through a hook (which is the other way for pages to be registered), they can add the metadata manually at that point, rather than relying on definePageMeta extraction.

πŸ“ Checklist

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

@danielroe danielroe added bug Something isn't working ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf performance labels Oct 27, 2022
@danielroe danielroe requested a review from pi0 October 27, 2022 17:20
@danielroe danielroe self-assigned this Oct 27, 2022
@codesandbox
Copy link

codesandbox bot commented Oct 27, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify
Copy link

netlify bot commented Oct 27, 2022

βœ… Deploy Preview for nuxt3-docs ready!

Name Link
πŸ”¨ Latest commit cc8fa9a
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/635bb3300737050008193985
😎 Deploy Preview https://deploy-preview-8536--nuxt3-docs.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf performance
Projects
None yet
2 participants