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

feat(auto-import): custom include option #4834

Merged
merged 3 commits into from
May 6, 2022
Merged

Conversation

antfu
Copy link
Member

@antfu antfu commented May 6, 2022

πŸ”— 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

Allowing auto import / components to work with custom extension files.

πŸ“ Checklist

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

@netlify
Copy link

netlify bot commented May 6, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit ec13db4
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/6274e4cbf047630008ccf1d1

@pi0
Copy link
Member

pi0 commented May 6, 2022

The new option looks good to me but can you please elaborate more about "to work with custom extension files" usecase?

@antfu
Copy link
Member Author

antfu commented May 6, 2022

Here is an example, in UnoCSS's docs, we'd like to use markdown files as Vue components so we installed vite-plugin-md to transform md to Vue SFC and let Vue's compiler handle the rest. We could configure Vue by this so it treats .md as Vue SFC:

https://github.com/antfu/unocss/blob/9a2bed77e8a3433454aab66f9c3ea2b2bbb7bcf6/interactive/nuxt.config.ts#L33-L35

https://github.com/antfu/unocss/blob/6aa5f9fad9dda65ffceef1455566b4233f7db278/interactive/modules/markdown.ts

With this we could get it work, but the .md will not be processed by auto imports thus you lost the capability of using components in the markdown. This PR simply expose those options for that capability.

@pi0
Copy link
Member

pi0 commented May 6, 2022

Thanks for explaining @antfu. What do you think to integrate include option to auto-include options.extensions

@antfu
Copy link
Member Author

antfu commented May 6, 2022

For API auto import I think it might make sense, but probably not for Components right?

Or should we have options.vueExtensions that we also pass to Vue's compiler?

@pi0
Copy link
Member

pi0 commented May 6, 2022

probably not for Components right?

It could be also useful for building components with markdown (https://mdxjs.com/ https://mdx.nuxtjs.org/)

@pi0 pi0 merged commit a862a67 into main May 6, 2022
@pi0 pi0 deleted the feat/auto-import-include branch May 6, 2022 11:11
@pi0 pi0 mentioned this pull request May 6, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants