Skip to content

Conversation

@atinux
Copy link
Member

@atinux atinux commented Aug 8, 2023

πŸ”— Linked issue

❓ 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

Add the components options to specify the components to add in the main bundle, useful for non-global components from UI library or a way to optimize global components that we use in many pages.

πŸ“ Checklist

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

@atinux atinux requested a review from farnabaz August 8, 2023 17:06
@nuxt-studio
Copy link

nuxt-studio bot commented Aug 8, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
content Edit on Studio β†—οΈŽ View Live Preview 79823fc

@netlify
Copy link

netlify bot commented Aug 8, 2023

βœ… Deploy Preview for nuxt-content ready!

Name Link
πŸ”¨ Latest commit 79823fc
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt-content/deploys/64d376a5538457000869fd7e
😎 Deploy Preview https://deploy-preview-2221--nuxt-content.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 configuration.

@nuxt-studio
Copy link

nuxt-studio bot commented Aug 8, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
content Edit on Studio β†—οΈŽ View Live Preview b727023

showURL: false
}
},
components: [],
Copy link
Member

@farnabaz farnabaz Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about reusing markdown.tags option for this feature? We can extract all components from markdown.tags map and mark them as global.

!!! This will be a bit confusing if we want to mark a component as global without changing its name.

tags: {
  UButton: 'UButton'
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is a different feature than the tags itself.

We could use markdown.tags to get the extra components as synced though

// Add sync components to use not global components
const components = (options.components || []).map(pascalCase)

addPluginTemplate({
Copy link
Member

@farnabaz farnabaz Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if we mark these components as global instead of registering a custom plugin. Marking them as global will help other modules to list these components as global ones. Modules like nuxt-component-meta

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is to avoid using global components and put them in the main bundle of the application actually. I want to see if this improves the performance

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, Nuxt registers lazy version of global components, but here the goal is to include it directly inside main bundle.

https://github.com/nuxt/nuxt/blob/ce9aecca4a39e1d5e36e6b92c77e706f8f577445/packages/nuxt/src/components/templates.ts#L50-L63

@danielroe
Copy link
Member

danielroe commented Aug 9, 2023

Merged nuxt/nuxt#22558 to Nuxt, so it will be in v3.7 - might be worth experimenting with but do note my comments in the PR. It might be worth iterating on a few possible alternatives within content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants