Deploy Vite React App to GitHub Pages (2024)
HTML-код
- Опубликовано: 26 апр 2024
- Looking to deploy your Vite React app to GitHub Pages? This video provides a clear, step-by-step guide to get you started! Learn how to configure your project, set up a GitHub workflow, Vite config, and leverage GitHub Pages for deployment. Whether you're a seasoned React developer or just getting started with Vite, this tutorial will equip you to showcase your app to the world! ✨
#vitejs #react #react #github #deploy
Blog post: www.vddeveloper.online/blog/v...
If you use React Router in your project, you're probably facing an issue with empty pages (blank screen with no errors in the console) or 404 not found errors for your assets. Check out this video, I've covered those issues there: ruclips.net/video/uStf2HMXcAs/видео.html
I have never once commented on a youtube video but this video just saved me big time. I spent hours trying to figure it out but luckily finally came across this video. Thank you very much!
Appreciate it!
@@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
You saved me! Thank you so much!
You're welcome!
thanks buddy works like a charm appricated
You're welcome!
Thank you! It was vey helpful!
Appreciate it!
The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
Lifesaver tutorial for real, Deployed Easily at one go, Underrated Channel! Thank you, you have my like and subscribe!
So glad it was helpful! Thanks for subscribing!
@@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
Thank you so much
This was really helpful
Appreciate it!
@@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
Thanks brother. appreciate a lot.
😎
Thank you for this video
thanks for watching!
Thanks brother very helpful..
Appreciate it! 😊
Good looks crodie
it's work. thanks!!!!!!!!!!!!!!
No problem :)
дякую!
👌
Thank you
You're welcome
usually i don't comment in video but this video help me lot thanks for that 🥰
Thank you a lot! Glad it helped!
@@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
Thank you.
👌
thank you sir its works , it was more help full to me☺
Appreciate it a lot!
@@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
Thanks, I successfully deployed my code, but there is a problem with images/icons. Seems like there is some problem with relative paths.
Check out my new view where I showed how to fix this issue: ruclips.net/video/uStf2HMXcAs/видео.html&ab_channel=VladyslavDihtiarenko
Blank page, console is completely empty.
When I added the base property with the repo name, the deployment manages to render the Vite icon as the app icon in the tab title, so that works, but it's like the index.html is not served at all
Hi, welcome to my channel! I've just released a video showing how to address this issue in Vite React projects. Check it out: ruclips.net/video/uStf2HMXcAs/видео.htmlsi=xShS2ai5-dr4Ujl6
it's work. thanks 🤗👌
🫡
what if we use react-router-dom in the project? it requires more configurations to support react-router on GitHub pages
Check out my new video where I covered issues when we use React Router along with base url in Vite config file: ruclips.net/video/uStf2HMXcAs/видео.html
Здравствуйте! Владислав, а у меня возникают проблемы с отображением картинок которые находятся в папке assets. И в принципе с переходами на другие урл если не добавить роуты. Есть ли возможность как-то это решить?
Приветствую! Похоже, что многие сталкиваются с этой проблемой. И она кроется в base адресе, который мы устанавливаем в vite config.
В случае с переходом на другие роуты, проблема в React Router (подразумевая, что именно его вы используете), в котором нужно тоже прописывать basename: v5.reactrouter.com/web/api/BrowserRouter/basename-string
А в случае директории src/assets нужно смотреть отдельные случаи. Если статический импорт через import, то Vite решает проблему автоматически. Но если указываем путь в самом jsx (к примеру, в src атрибуте img тега), то возможно нужно самому к пути прибавлять base url, который доступен через import.meta.env.BASE_URL: vitejs.dev/guide/build.html#public-base-path
The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error
Honestly, I don't know what it is. I need a bigger picture of your issue. Contact me through social media to show a full error log
I'm confused, so you push the entire project, or just the content of "dist" folder created by the build process? Answer:
You don't need to push the dist folder. Push the entire project. 'Dist' is added to .gitignore automatically by Vite so Git doesn't track this folder (i.e. don't include it in commits history).
The dist folder (the builded project) is automatically created during the workflow as a build result (that's why we create this file)
@@VladyslavDihtiarenko thanks, why when I use the vite's website workflow it fails, I notice it doesn't create the extra branch
@@netizen_94 It didn't create that extra branch for me as well
can you help me sir, i followed but when i go to my website it doesn't show anything and it says error 404 in dev tools
ohh i got it, I misspelled my setbase😅 thanks anyway for the tutorial
Glad you solved it :)
I have a problem with my photos won't show in the page
Same issue occurred with my e-commerce project, I had to click on the shop menu button to render the product images.
I could help you if you share a link to you repo here or through social media. The issue could be with the baseUrl we set in Vite config, or with React Router if you use it in your project.
Yes that was the problem i fixed it already
what vscode theme is that?
Community Material Theme High Contrast: marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-community-material-theme
how do we deploy the backend?
This video is only about the frontend part. Consider to find another tutorial for backend.
In my sources i only have the options main and none, no gh-pages
Try to switch to Github Actions, and then again back to Deploy from a branch
@@VladyslavDihtiarenko i also get this unusual error 404 (main.jsx resource not found)in my console.Is there a specific way to put my main.jsx file path
Did you set "base" in your vite config according to your repo name? 0:45
For example, If your repo name is vite-react, set base: "/vite-react/"
I did, but when i deploy it first routes to the not found page
@@Thee_Don96 send me a link to your repo
i am gettingn a blank page bro !!
any errors in the console?
Your tutorial was very bad. Not even a single work has been done. He is not deployed
Welcome to my channel! To improve the tutorial, could you tell me what deployment issues you faced?