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

Config 'base' option works on dev, but doesn't quite work on build/production. in Default Theme #4414

Closed
4 tasks done
JohnBrayden opened this issue Dec 9, 2024 · 2 comments
Labels
need more info Further information is requested

Comments

@JohnBrayden
Copy link

Describe the bug

Describe the bug

When I enable the base property in the config file, it works fine in the development environment (dev), but it doesn't work at all in production, and I encounter several issues that I couldn't identify or resolve. Please note that I am not using any custom or complex themes; I am only working with the default theme and .md files.

Version?:

I am using vitepress version ^1.5.0.

Errors:

Error

Error2

Reproduction

1 - Create the application using the command: npx vitepress init
2 - Configure the base property in the config file, set it to: (/docs/)
3 - Test the application in the development environment.
4 - Build the site for production.
5 - Uploaded it to GitHub.
6 - Deployed it on Netlify.

Expected behavior

I expect my site to display correctly and function normally under the mysite.org/docs/ path without any issues. This includes proper loading of all assets (CSS, JS, and images) and correct handling of internal links in both development and production environments.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400F
    Memory: 7.22 GB / 15.85 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  Utilities:
    Git: 2.47.1.
    Curl: 8.9.1 - C:\Windows\system32\curl.EXE
  IDEs:
    VSCode: 1.95.3 - C:\Users\PCD\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
    Visual Studio: 16.11.35425.106 (Visual Studio Community 2019), 17.12.35527.113 (Visual Studio Community 2022)
  Browsers:
    Edge: Chromium (131.0.2903.70)
    Internet Explorer: 11.0.22621.3527

Additional context

No response

Validations

@JohnBrayden JohnBrayden added the bug: pending triage Maybe a bug, waiting for confirmation label Dec 9, 2024
@JohnBrayden JohnBrayden changed the title Config 'base' option works on dev, but doesn't quite work on build in Default Theme Config 'base' option works on dev, but doesn't quite work on build/production. in Default Theme Dec 9, 2024
@brc-dd
Copy link
Member

brc-dd commented Dec 9, 2024

How are you deploying it to github/netlify? If you've configured base for github pages it should be same as the repo name. If you're deploying for netlify or your github repo is of form <user/org>.github.io, then you need to configure outDir to something like .vitepress/dist/docs.

@brc-dd brc-dd added need more info Further information is requested and removed bug: pending triage Maybe a bug, waiting for confirmation labels Dec 9, 2024
@JohnBrayden
Copy link
Author

Thank you! It worked successfully. I kept searching extensively through the VitePress documentation, but I couldn’t find a clear solution or even anything related to configuring the base and resolving its issues.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants