Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added Vitepress packaging to FAQ section #2776

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Jan 10, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:
    Add solutions to common problems

What is the current behavior?

Issue Number: N/A
#2684

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Documentation
    • Added a new FAQ section addressing a VitePress build error when using the Opentiny component package
    • Provided a solution for resolving the ERR_UNSUPPORTED_DIR_IMPORT error by configuring noExternal in VitePress settings

Copy link

coderabbitai bot commented Jan 10, 2025

Warning

Rate limit exceeded

@James-9696 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 27 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 60f205c and 18f2c02.

📒 Files selected for processing (2)
  • examples/sites/demos/pc/webdoc/faq-en.md (2 hunks)
  • examples/sites/demos/pc/webdoc/faq.md (2 hunks)

Walkthrough

This pull request adds documentation to the FAQ sections in both English and Chinese markdown files, addressing a specific issue with VitePress and the Opentiny component package. The new content explains a build error (ERR_UNSUPPORTED_DIR_IMPORT) that occurs during documentation generation and provides a solution by recommending a configuration change in the vitepress/config.js file to resolve path resolution problems during server-side rendering.

Changes

File Change Summary
examples/sites/demos/pc/webdoc/faq-en.md Added new section explaining VitePress build error with Opentiny component package
examples/sites/demos/pc/webdoc/faq.md Added Chinese version of the FAQ section addressing the VitePress build error

Possibly related PRs

  • [2387] Updates documentation for component imports
  • [2391] Focuses on documentation improvements for component imports
  • [2403] Enhances documentation for theme configuration
  • [2406] Updates documentation for directives
  • [2510] Corrects documentation related to component integration

Suggested labels

documentation

Suggested reviewers

  • zzcr

Poem

🐰 Vitepress builds, oh what a sight!
An error lurks, but we'll make it right
Config tweak here, a path resolved there
Documentation saves us from despair
Code builds smooth, no more fright! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request (功能增强) label Jan 10, 2025
Copy link

Walkthrough

This pull request adds solutions to common problems encountered when using Vitepress with the Opentiny component package. It provides a specific solution to the error ERR_UNSUPPORTED_DIR_IMPORT by configuring the vitepress/config.js file to handle external dependencies correctly.

Changes

File Summary
examples/sites/demos/pc/webdoc/faq-en.md
examples/sites/demos/pc/webdoc/faq.md
Added a section detailing the solution to the ERR_UNSUPPORTED_DIR_IMPORT error when using Vitepress with the Opentiny component package.


_Reason:_ Using Vitepress packaging, the suffix paths such as js/css related to file references in the component package cannot be found. Causing error: ERR_UNSUPPORTED_DIR_IMPORT

_Solution:_ Resolve the error issue by configuring the 'vitepress/config. js' file:

Choose a reason for hiding this comment

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

Ensure that the vitepress/config.js file is correctly configured to handle external dependencies, as this is crucial for resolving the ERR_UNSUPPORTED_DIR_IMPORT error.


_原因:_ 使用vitepress打包,找不到组件包内文件相关引用的js/css等后缀路径。导致报错:ERR_UNSUPPORTED_DIR_IMPORT

_解决方案:_ 通过配置`vitepress/config.js`文件,解决报错问题:

Choose a reason for hiding this comment

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

确保 vitepress/config.js 文件正确配置以处理外部依赖关系,这对于解决 ERR_UNSUPPORTED_DIR_IMPORT 错误至关重要。

Copy link

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

@James-9696 James-9696 changed the title feat: add solutions to common problems docs: add solutions to common problems Jan 10, 2025
@github-actions github-actions bot added documentation 对文档的改进或补充 and removed enhancement New feature or request (功能增强) labels Jan 10, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
examples/sites/demos/pc/webdoc/faq.md (1)

20-21: Improve section title formatting

The section title uses a Chinese comma (、) which is inconsistent with the English version. Consider standardizing the punctuation across both versions.

-## 2、在vitepress中,引用opentiny组件包,使用vitepress打包命令:pnpm docs:build,报错:ERR_UNSUPPORTED_DIR_IMPORT
+## 2. 在vitepress中,引用opentiny组件包,使用vitepress打包命令:pnpm docs:build,报错:ERR_UNSUPPORTED_DIR_IMPORT
examples/sites/demos/pc/webdoc/faq-en.md (3)

20-21: Fix punctuation and formatting in English title

The section title uses Chinese punctuation marks (、) and inconsistent spacing around punctuation.

-## 2、In Vitepress, reference the Opentiny component package and use Vitepress to package the command: pnpm docs:build, report errors: ERR_UNSUPPORTED_DIR_IMPORT
+## 2. In VitePress, when using Opentiny component package with `pnpm docs:build`, error: ERR_UNSUPPORTED_DIR_IMPORT

22-23: Fix Chinese punctuation marks in English text

The text uses Chinese punctuation marks (:) instead of English colons (:).

-_Reason:_ Using Vitepress packaging, the suffix paths such as js/css related to file references in the component package cannot be found. Causing error: ERR_UNSUPPORTED_DIR_IMPORT
+_Reason:_ Using VitePress packaging, the suffix paths (js/css) related to file references in the component package cannot be found, causing error: ERR_UNSUPPORTED_DIR_IMPORT

24-25: Fix formatting and punctuation

The text uses Chinese punctuation and inconsistent product name casing.

-_Solution:_ Resolve the error issue by configuring the 'vitepress/config. js' file:
+_Solution:_ Resolve the error by configuring the `vitepress/config.js` file:
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3502466 and 60f205c.

📒 Files selected for processing (2)
  • examples/sites/demos/pc/webdoc/faq-en.md (1 hunks)
  • examples/sites/demos/pc/webdoc/faq.md (1 hunks)
🔇 Additional comments (1)
examples/sites/demos/pc/webdoc/faq.md (1)

26-34: Verify the VitePress configuration solution

The solution looks technically correct. However, let's verify if this is the minimal configuration needed and if there are any version-specific requirements.

✅ Verification successful

Configuration is correct and minimal

The VitePress configuration is the minimal required solution to resolve the ERR_UNSUPPORTED_DIR_IMPORT error when using OpenTiny components. The noExternal: [/@opentiny\//] setting specifically targets only OpenTiny packages during SSR builds, without adding any unnecessary configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for similar VitePress configurations in the codebase
rg -g '*.js' -g '*.ts' 'noExternal.*opentiny' 

# Check if there are any VitePress config files that might need this update
fd -e js -e ts 'vitepress.config' -x echo "Found config file: {}"

Length of output: 113


Script:

#!/bin/bash
# Search for any Vite or VitePress config files
fd -e js -e ts -e mjs '(vite\.config|\.vitepress.+config)' -x echo "Found config: {}"

# Search for noExternal configurations
rg -g '*.{js,ts,md}' 'noExternal' -A 2 -B 2

# Search for VitePress documentation or examples
fd -g 'README*.md' -x rg -l 'vitepress'

Length of output: 1484


Script:

#!/bin/bash
# Check package.json files for VitePress dependencies
fd package.json -x rg -l "vitepress"

# Check the full context of the FAQ files
cat examples/sites/demos/pc/webdoc/faq.md
cat examples/sites/demos/pc/webdoc/faq-en.md

# Look for any SSR-related configuration or documentation
rg -g '*.{md,js,ts}' -l 'ssr.*config'

Length of output: 2249

@James-9696 James-9696 changed the title docs: add solutions to common problems docs: adds documentation to the FAQ sections Jan 10, 2025
@James-9696 James-9696 changed the title docs: adds documentation to the FAQ sections docs: added Vitepress packaging to FAQ section Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 对文档的改进或补充
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants