fix(docs): add missing resolveComponent import in code-highlighter demo#126
Merged
cc-hearts merged 1 commit intoJul 6, 2026
Merged
Conversation
The code-highlighter demo used resolveComponent() without importing it from vue. It worked in the docs app only because of unplugin-auto-import, but users copying the demo code would hit 'resolveComponent is not defined'. Add the explicit import to match the gpt-vis demo convention.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 This is a ...
🔗 Related Issues
💡 Background and Solution
The
code-highlighterdemo (packages/docs/src/pages/markdown/demo/code-highlighter.vue) calledresolveComponent("ax-code-highlighter")without importingresolveComponentfromvue.It only worked inside the docs app because
unplugin-auto-importis configured withimports: ["vue", ...], which auto-importsresolveComponentglobally. However, the demo code is displayed to users as a copyable example, so anyone copying it would hitresolveComponent is not defined.This is inconsistent with the sibling
gpt-visdemo (packages/docs/src/pages/components/bubble/demo/gpt-vis.vue), which importsresolveComponentexplicitly.Solution: Add
resolveComponentto thefrom "vue"import block, placed afterrefto match thegpt-visdemo convention. The displayed demo source (generated intopublic/markdown/*.md) regenerates from this.vuefile, so a single source fix covers all rendered examples (examples.md,rich-text.mdand their-envariants).📝 Change Log
resolveComponentimport to thecode-highlighterdemo so the copyable example runs without the docs app's auto-import setup.code-highlighterdemo 补充缺失的resolveComponent导入,使展示的可复制示例在脱离文档站点的 auto-import 配置时也能正常运行。