Deploy Vite React App to GitHub Pages (2024)

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ย. 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
    Subscribe for more videos like this: / @vladyslavdihtiarenko
    Blog post: www.vd-develop...
    Let's connect:
    Website: www.vd-develop...
    Blog: www.vd-develop...
    Instagram: / vladislavdegtyarenko
    Telegram: t.me/@Vladislav_Degtyarenko

ความคิดเห็น • 124

  • @VladyslavDihtiarenko
    @VladyslavDihtiarenko  3 หลายเดือนก่อน +1

    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: th-cam.com/video/uStf2HMXcAs/w-d-xo.html

  • @alimanghat9114
    @alimanghat9114 3 หลายเดือนก่อน +2

    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!

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Appreciate it!

    • @zainmashhood7943
      @zainmashhood7943 3 หลายเดือนก่อน

      @@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

  • @ABHISHEKPOKHARKAR-ii9fb
    @ABHISHEKPOKHARKAR-ii9fb หลายเดือนก่อน

    you did really amazing job !! after so main fail how to deploy on github after watching this video all problem solve great!!!

  • @amansemwal9514
    @amansemwal9514 9 วันที่ผ่านมา

    hey im not getting the gh-pages option, ive tried multiple times.
    its showing deployed, but only a blank screen shows up

  • @maanasaprathapchander7575
    @maanasaprathapchander7575 หลายเดือนก่อน +2

    I'm facing an issue where after clicking on "first commit", I can't see the page that is displayed to you

    • @rohankoli3695
      @rohankoli3695 วันที่ผ่านมา

      Im also facing same issue.....did u got any solution?

  • @reiyua
    @reiyua 19 วันที่ผ่านมา

    Worked for me! Cheers you legend!!

  • @am_horrorfinder
    @am_horrorfinder วันที่ผ่านมา

    guys, this guy is absolute straight to point guy. I wondered this is new channel owner. thanks man. love from INDIA.

  • @isuskrist7416
    @isuskrist7416 16 วันที่ผ่านมา +1

    Nice video. What VSCode theme are you using?

    • @Victusu
      @Victusu 14 วันที่ผ่านมา

      I'm interested in that too

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  11 วันที่ผ่านมา

      @@isuskrist7416 Community Material Theme High Contrast: marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-community-material-theme

  • @dmitry9463
    @dmitry9463 8 วันที่ผ่านมา

    How to make it automatically redeploy after pushing new changes to the repo? Because I've added some changes, pushed them to the repo, but nothing has changed on the page by public link.

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  8 วันที่ผ่านมา

      Did you push to the main branch?

    • @dmitry9463
      @dmitry9463 8 วันที่ผ่านมา

      @@VladyslavDihtiarenko Yes, I pushed to the main branch

  • @abrahamouattara8757
    @abrahamouattara8757 2 หลายเดือนก่อน

    the problem is that when I refresh or when I type the url of the path of my pages by hand I get 404 error

  • @Rao_vishal321
    @Rao_vishal321 16 วันที่ผ่านมา

    It helps me a lot thanks ❤

  • @ashanime4867
    @ashanime4867 2 หลายเดือนก่อน

    thanks buddy, this is the best video I have seen

  • @AlonaZherdetska
    @AlonaZherdetska 4 หลายเดือนก่อน +1

    Thank you! It was vey helpful!

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  4 หลายเดือนก่อน

      Appreciate it!

    • @zainmashhood7943
      @zainmashhood7943 3 หลายเดือนก่อน

      The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

  • @rimi4014
    @rimi4014 26 วันที่ผ่านมา

    Thx, it was really helpful

  • @netbug94
    @netbug94 2 หลายเดือนก่อน

    make sure you replace main with master in the workflow or vice-versa

  • @maryamsaleh5259
    @maryamsaleh5259 3 หลายเดือนก่อน

    Thanks, I successfully deployed my code, but there is a problem with images/icons. Seems like there is some problem with relative paths.

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Check out my new view where I showed how to fix this issue: th-cam.com/video/uStf2HMXcAs/w-d-xo.html&ab_channel=VladyslavDihtiarenko

  • @kresimircosic3753
    @kresimircosic3753 3 หลายเดือนก่อน

    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

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน +1

      Hi, welcome to my channel! I've just released a video showing how to address this issue in Vite React projects. Check it out: th-cam.com/video/uStf2HMXcAs/w-d-xo.htmlsi=xShS2ai5-dr4Ujl6

  • @Lightyagami-w6v
    @Lightyagami-w6v 28 วันที่ผ่านมา

    well i got it you have used continuous integration for workflow to check the code format and its linting but one thing is bothering me ....say if i commit again on this repo will it reflect on the go like the vercel or we have to implement CD(continuous deployment ) for that?

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  20 วันที่ผ่านมา

      Sure, that's the purpose of GitHub Actions, to automate that deploying process

  • @zainmashhood7943
    @zainmashhood7943 3 หลายเดือนก่อน

    The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      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

  • @AliHelmi-GET
    @AliHelmi-GET 3 หลายเดือนก่อน

    what if we use react-router-dom in the project? it requires more configurations to support react-router on GitHub pages

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Check out my new video where I covered issues when we use React Router along with base url in Vite config file: th-cam.com/video/uStf2HMXcAs/w-d-xo.html

  • @Timepass-xb2yb
    @Timepass-xb2yb 3 หลายเดือนก่อน

    Thank you so much
    This was really helpful

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Appreciate it!

    • @zainmashhood7943
      @zainmashhood7943 3 หลายเดือนก่อน

      @@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

  • @RealTomNook
    @RealTomNook 3 หลายเดือนก่อน

    You saved me! Thank you so much!

  • @whitesonar
    @whitesonar 28 วันที่ผ่านมา

    awesome, thanks

  • @potato-ip9tp
    @potato-ip9tp 4 หลายเดือนก่อน +3

    it's work. thanks!!!!!!!!!!!!!!

  • @arunuraj1532
    @arunuraj1532 2 หลายเดือนก่อน

    can u please tell how to add .env variables ? what changes should i make in the deploy.yml file

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  2 หลายเดือนก่อน

      Environment variables are added in GitHub repository settings

  • @jjyyyy-zc6cr
    @jjyyyy-zc6cr 3 หลายเดือนก่อน

    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

    • @jjyyyy-zc6cr
      @jjyyyy-zc6cr 3 หลายเดือนก่อน

      ohh i got it, I misspelled my setbase😅 thanks anyway for the tutorial

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Glad you solved it :)

  • @notacupofmilk2021
    @notacupofmilk2021 2 หลายเดือนก่อน

    Thank you so much!

  • @Kerchiano
    @Kerchiano 3 หลายเดือนก่อน

    Здравствуйте! Владислав, а у меня возникают проблемы с отображением картинок которые находятся в папке assets. И в принципе с переходами на другие урл если не добавить роуты. Есть ли возможность как-то это решить?

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Приветствую! Похоже, что многие сталкиваются с этой проблемой. И она кроется в 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

  • @MonkeyWrenchMechanicManiac
    @MonkeyWrenchMechanicManiac 4 หลายเดือนก่อน

    Thanks brother very helpful..

  • @TheCodeBreaker190
    @TheCodeBreaker190 4 หลายเดือนก่อน

    Thanks brother. appreciate a lot.

  • @mohiramansurovna4295
    @mohiramansurovna4295 4 หลายเดือนก่อน

    Thank you for this video

  • @terezachudejova4189
    @terezachudejova4189 หลายเดือนก่อน

    I used your tutorial several times and it always worked! The last time I used it was like a week ago. I followed the exact same steps today and after pushing the project to GH and setting the actions permission, I don't see any workflow in the Actions section. I did the exact same thing as always. Do you have any idea what could went wrong? Thank you.

    • @terezachudejova4189
      @terezachudejova4189 หลายเดือนก่อน

      For anyone having the same issue - I figured it out! 😁 I used “npm create vite@latest”, which I sometimes used but not in the case of deploying it to GH pages. So don’t 😆 With “npm create vite” it works 😊 Also some may have problems because of not entering the project in terminal first before initializing the repo. So enter the folder with “cd project-name” and then “git init” 😊

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  หลายเดือนก่อน

      Thanks for sharing your workaround. If anyone else struggles with missing workflows, try the steps below:
      Go to Settings → Pages
      Under Source, switch to "Github Actions", save.
      Then, switch back to "Deploy from branch" and select the "gh-pages" branch.
      It might help!

  • @prodpreston
    @prodpreston 3 หลายเดือนก่อน

    Good looks crodie

  • @jaysontadayca8838
    @jaysontadayca8838 4 หลายเดือนก่อน

    how do we deploy the backend?

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      This video is only about the frontend part. Consider to find another tutorial for backend.

  • @kulikitakati549
    @kulikitakati549 3 หลายเดือนก่อน

    what vscode theme is that?

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Community Material Theme High Contrast: marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-community-material-theme

  • @Thee_Don96
    @Thee_Don96 4 หลายเดือนก่อน

    In my sources i only have the options main and none, no gh-pages

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  4 หลายเดือนก่อน

      Try to switch to Github Actions, and then again back to Deploy from a branch

    • @Thee_Don96
      @Thee_Don96 4 หลายเดือนก่อน

      @@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

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  4 หลายเดือนก่อน

      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/"

    • @Thee_Don96
      @Thee_Don96 4 หลายเดือนก่อน

      I did, but when i deploy it first routes to the not found page

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  4 หลายเดือนก่อน

      @@Thee_Don96 send me a link to your repo

  • @Rootblack04
    @Rootblack04 4 หลายเดือนก่อน

    it's work. thanks 🤗👌

  • @farazk9729
    @farazk9729 4 หลายเดือนก่อน

    Thank you.

  • @funfstuck
    @funfstuck 4 หลายเดือนก่อน

    дякую!

  • @Tjiaz-
    @Tjiaz- 3 หลายเดือนก่อน

    Thank you

  • @ШахрозШейх
    @ШахрозШейх 3 หลายเดือนก่อน

    Your tutorial was very bad. Not even a single work has been done. He is not deployed

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Welcome to my channel! To improve the tutorial, could you tell me what deployment issues you faced?

    • @jeevan1409
      @jeevan1409 2 หลายเดือนก่อน

      Have some respect and ask your doubts. If not him somebody will answer you. Learn to be polite dude.

  • @mrxmart3238
    @mrxmart3238 18 วันที่ผ่านมา

    net::ERR_ABORTED 404 (Not Found)

    • @mrxmart3238
      @mrxmart3238 18 วันที่ผ่านมา

      im not using React-Router-dom but its still blank

  • @muhammedyaseen1404
    @muhammedyaseen1404 7 ชั่วโมงที่ผ่านมา

    Thanks man, i spent a so much time figuring it out

  • @ilgul9177
    @ilgul9177 20 วันที่ผ่านมา +1

    Підписався на твій канал. Дякую за контент. Слава Україні!

  • @otzmediaz4387
    @otzmediaz4387 3 หลายเดือนก่อน +2

    usually i don't comment in video but this video help me lot thanks for that 🥰

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Thank you a lot! Glad it helped!

    • @zainmashhood7943
      @zainmashhood7943 3 หลายเดือนก่อน

      @@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

  • @netbug94
    @netbug94 3 หลายเดือนก่อน +1

    I'm confused, so you push the entire project, or just the content of "dist" folder created by the build process? Answer:

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน +1

      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)

    • @netbug94
      @netbug94 3 หลายเดือนก่อน

      @@VladyslavDihtiarenko thanks, why when I use the vite's website workflow it fails, I notice it doesn't create the extra branch

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน +1

      @@netbug94 It didn't create that extra branch for me as well

  • @HasnainAli_313
    @HasnainAli_313 หลายเดือนก่อน

    followed step wise but after push , i dont see deployment in action and after deploying nothing shows

  • @SnowUniverse
    @SnowUniverse หลายเดือนก่อน

    Can i add google adsense to the webstite? If yes, how do i do it?

  • @fatimajimoh3405
    @fatimajimoh3405 2 หลายเดือนก่อน

    Mine displayed this:
    Unexpected Application Error!
    404 Not Found

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  2 หลายเดือนก่อน +1

      Check this out: th-cam.com/video/uStf2HMXcAs/w-d-xo.htmlsi=kFW2bxrcodifhFvH

  • @The_DollMaster
    @The_DollMaster 2 หลายเดือนก่อน

    Doesn't work :c

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  2 หลายเดือนก่อน

      Thanks for letting me know! To help debug the issue, could you tell me what step in the deployment process isn't working as expected? Are there any error messages you're seeing?

  • @yacinbensidahmed6587
    @yacinbensidahmed6587 4 หลายเดือนก่อน +1

    I have a problem with my photos won't show in the page

    • @dheerajsaini1353
      @dheerajsaini1353 3 หลายเดือนก่อน +1

      Same issue occurred with my e-commerce project, I had to click on the shop menu button to render the product images.

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน +1

      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.

    • @dheerajsaini1353
      @dheerajsaini1353 3 หลายเดือนก่อน

      Yes that was the problem i fixed it already

  • @nihitjaiswal6416
    @nihitjaiswal6416 2 หลายเดือนก่อน +1

    Thanks a lot!

  • @huzaifaimran9468
    @huzaifaimran9468 3 หลายเดือนก่อน

    Lifesaver tutorial for real, Deployed Easily at one go, Underrated Channel! Thank you, you have my like and subscribe!

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน +1

      So glad it was helpful! Thanks for subscribing!

    • @zainmashhood7943
      @zainmashhood7943 3 หลายเดือนก่อน

      @@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

  • @alvincalma1009
    @alvincalma1009 2 หลายเดือนก่อน

    This is greatly helpful!

  • @20IT029MathiyarasuM
    @20IT029MathiyarasuM 4 หลายเดือนก่อน

    thank you sir its works , it was more help full to me☺

    • @VladyslavDihtiarenko
      @VladyslavDihtiarenko  3 หลายเดือนก่อน

      Appreciate it a lot!

    • @zainmashhood7943
      @zainmashhood7943 3 หลายเดือนก่อน

      @@VladyslavDihtiarenko The process '/opt/hostedtoolcache/node/16.20.2/x64/bin/npm' failed with exit code 1 please help me with this error

  • @suryanagcs
    @suryanagcs 4 หลายเดือนก่อน

    thanks buddy works like a charm appricated

  • @yaswantkumar9112
    @yaswantkumar9112 4 หลายเดือนก่อน +1

    i am gettingn a blank page bro !!