Closed xiaoxian521 closed 3 years ago
After packaging, open http-server locally to allow the project to be fully OK, but the deployment of GitHub will report 404, and no resources can be found
@yyx990803 You da, this problem has troubled me for a long time. Can you solve it and support you forever
@xiaoxian521 I think you need to add base
option...?
// .vitepress/config.js
module.exports = {
base: '/standard/',
...
}
@kiaking @xiaoxian521 i think i can answer this question .
This seems to be a dns issues . If you are in China, you can try to use a global proxy.
When i turn off the proxy, i also can't access this site.
The access path is as follows: https://xiaoxian521.github.io/
I am here config.js base: "/" is added to the, but it still doesn't work
@yuxino But there is no problem with vuepress,It should be the same
@xiaoxian521 i can't access any github.io
site today , i think it's same question not vitepress. u can't access that http://elemefe.github.io/mint-ui, right ?
@yuxino I can open it http://elemefe.github.io/mint-ui
Oh wait, yea yea yea I recall this issue. We can't use underscore as a folder name in GitHub pages. So _assets
folders doesn't work. We need to add .nojekyll
file to the root.
@xiaoxian521 As a workaround, could you test placing public/.nojekyll
file, and then deploy the build?
Perfect solution. Thank you very much
Nice! OK let's make this issue an enhancement issue. Maybe we could automatically include .nojekyll
file at the built time, or maybe we should rename _assets
folder to asstes
like VuePress does.
I support it very much
Of course, another way is to configure deploy.sh file as
#!/usr/bin/env sh
# 确保脚本抛出遇到的错误
set -e
# 生成静态文件
npm run docs:build
# 进入生成的文件夹
cd docs/.vitepress/dist
touch .nojekyll
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# 如果发布到 https://<USERNAME>.github.io
git push -f git@github.com:xiaoxian521/xiaoxian521.github.io.git master:main
# 如果发布到 https://<USERNAME>.github.io/<REPO>
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
cd -
Yeah that works too 👍
@kiaking in Vite 2, _assets
was renamed to assets
. This issue could be closed.
! Actually I didn't know that. Maybe we should update docs about .nojekyll
warning? (remove the alert)
https://vitepress.vuejs.org/guide/deploy.html#github-pages
Yes, I forgot about that alert! I can send a PR removing it if you want 👍🏼
It is actually configurable now: https://vitejs.dev/config/#build-assetsdir
But the default is assets
, which is great 🙂
Great! PR would be awesome 🙌 Not sure if adding .nojekyll
is still preferable as a best practice, but even in that case I think we should just include .nojekyll
at build time (if anyone one has problem related to it, then we would probably get anotehr issue opened so 😃 ).
Describe the bug Package and deploy to GitHub, no resource package 404 error found
To Reproduce Steps to reproduce the behavior: Package and deploy to GitHub, no resource package 404 error found
Expected behavior Package and deploy to GitHub, no resource package 404 error found
System Info
Additional context Add any other context about the problem here.