Struggling with Laravel + Vite

Sdílet
Vložit
  • čas přidán 25. 08. 2024
  • Laravel Herd has a nice `share` feature built in, but it doesn't handle Vite very well. Watch me fix that issue!
    • Laravel Herd's share: herd.laravel.c...
    • Ngrok: ngrok.io/

Komentáře • 77

  • @polojuninho
    @polojuninho Před měsícem +6

    I dont even use Laravel, but the way you make the video was awesome!

  • @Alpha0YZ
    @Alpha0YZ Před měsícem +5

    Maybe you should print the public URL in your terminal to make it easier to browse or share 😊. Great tip and excellent inspiration for my current project 🙂. I had the same problem with Laravel Herd; everything was working except the Vite server.

  • @julianfbeck
    @julianfbeck Před měsícem +13

    you can also use cloudlflare tunnels and you can even specify a subdomain so i doesnt rotate as ngrok does. nice work 😊

    • @julianfbeck
      @julianfbeck Před měsícem

      cloudflared tunnel create

    • @codingscience0
      @codingscience0 Před měsícem

      I'm using it to expose my RPi server to the web. Running 2-3 apps

  • @kingstalker
    @kingstalker Před měsícem +3

    gotta love ryan reynolds doing laravel 😃

  • @umairsaeed5925
    @umairsaeed5925 Před měsícem +16

    my whole life I was pronounce ngrok wrong. I pronounce it as NG ROK 😭

  • @kyngcytro
    @kyngcytro Před měsícem +3

    Who else was waiting for him to add the ngrok URL to the output? 😆

  • @hectorcenteno7315
    @hectorcenteno7315 Před měsícem +2

    Man ! I learned a lot with this video! And I’m a 10+ years experience developer. 😂

  • @MatteoPresot
    @MatteoPresot Před 22 dny

    Love this contents and how much important is writing clean and readable code. This is also one case when moving logic to a job does not make really sense. So great job!!!

  • @haidubogdan8712
    @haidubogdan8712 Před měsícem +1

    good ol ngrok, good for paypal development notifications also

  • @guillermocava3568
    @guillermocava3568 Před měsícem +3

    Any time I hear someone say "beware of infinite loops", I always respond "unless you're Aaron Francis" - Dude this is sick! glad you got it working
    I feel like through some vite conf related to `server.host` you could also set the public domain, but the idea of not even touching the vite config file directly is also pretty dope

  • @sajjadhossainshohag3459
    @sajjadhossainshohag3459 Před měsícem

    You are awesome Aaron, Thanks.

  • @sebastianhilger6083
    @sebastianhilger6083 Před 28 dny

    Wow I learned soooo much. And so useful right away! Thank you! Would Laravel Context maybe be a replacement for the sharefile solution? This might be a package idea - are thinking of making it into one?

  • @SimonHamp
    @SimonHamp Před měsícem

    Great vid as always man! Would love to see all of this running from a single command
    Then you can have my kingdom

  • @ivanjelenic5627
    @ivanjelenic5627 Před měsícem

    Thanks, learnt signalable commands!

  • @phefochis6149
    @phefochis6149 Před měsícem

    Thanks Aaron, great content 🎉

  • @stefan48391
    @stefan48391 Před 9 dny

    Why not using expose?

  • @mahmoudmousa2405
    @mahmoudmousa2405 Před měsícem

    Hey Aaron,
    I really like the camera setup you have. What camera and lights do you use?

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      It's a Canon R6 running through an Elgato camlink!

  • @vzlamrbeastfan
    @vzlamrbeastfan Před měsícem

    I think you can also change the Vite server url using a env variable, no need to manually update the public/hot file

    • @aarondfrancis
      @aarondfrancis  Před měsícem

      But then I'd have to change the vite config anytime I want to share

    • @AnthonyBullard
      @AnthonyBullard Před měsícem +1

      You could have your command start vite as well and supply the ENV var that way

  • @MatthewPoulterVCSW
    @MatthewPoulterVCSW Před měsícem

    Did you manage to get WebSockets proxied as well to support auto-reloading?

    • @aarondfrancis
      @aarondfrancis  Před měsícem

      Yup!

    • @MatthewPoulterVCSW
      @MatthewPoulterVCSW Před měsícem

      @@aarondfrancis Hmm, I must have missed something then. I'm getting `WebSocket connection to 'wss://site.test/' failed` errors.

    • @MatthewPoulterVCSW
      @MatthewPoulterVCSW Před měsícem

      Found it! Turn off HTTPS in Herd :)

  • @richeriswertres
    @richeriswertres Před měsícem

    Hey! I used vite in past few months in Windows, I also encountered that issue. I thought that was okay and normal not to render frontend in my phone after "npm run dev" because there was no nodejs installed in my phone, so i "npm run build" it and it works (atleast i will saw the changes) in the phone but only working if "npm run dev" server is stop. Does Ngrok supported in windows? I will try it, if it is.

  • @techietoons
    @techietoons Před měsícem +1

    Editing glitch at 1:50... hehe

  • @dabijavictor6069
    @dabijavictor6069 Před měsícem

    why don't using docker sail ?

    • @aarondfrancis
      @aarondfrancis  Před měsícem

      I don't need it. Herd does everything I need.

  • @mikeziri
    @mikeziri Před měsícem

    iOS Simulator should also help because you can hit local hosts.

  • @Michielofzo
    @Michielofzo Před měsícem +1

    Can you share the code? This could be a great plugin 😀 Or atleast something i include in my composer.json dev in every project.

  • @Pekz00r
    @Pekz00r Před měsícem

    Great work and great watch!
    Will you publish the code somewhere? Maybe even make a package?

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      Yeah! If the Herd and/or Laravel team doesn't fix it I totally will

    •  Před měsícem +1

      @@aarondfrancis I would suggest you doing it anyway, because the 'Expose' herd uses always gives you a different URL in the free version, which is sad when you might need a static one, and in addition it only works for an hour then you need a restart.

  • @heyimamaker
    @heyimamaker Před měsícem

    I noticed that your auto complete seems to be scoped to the file contents and isn't suggesting everything under the moon.
    Do you have any special configuration?

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      I... have no clue 🙈

    • @heyimamaker
      @heyimamaker Před měsícem

      @@aarondfrancis I wish they had a settings diff 🤣
      I noticed some scope configs for search and the file structure, but your suggestions look so clean.
      I'll just have to try it out!

  • @ahmad-murery
    @ahmad-murery Před měsícem

    Interesting.
    Now how does Laravel handle infinite loops?
    Thanks Aaron!

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      Sorry I don't understand the question

    • @ahmad-murery
      @ahmad-murery Před měsícem

      @@aarondfrancis I mean @ 11:15 the while(true) loop.
      as I know php uses set_time_limit() / max_execution_time configuration to limits the maximum execution time, and setting that to 0 (no limit) may affect the server load and it may be better to run such script in the background.
      anyway, I replayed that part again and I think you mentioned that the process facade will put it in the background.
      Thanks once again.

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      Ah this is a CLI, so there should be no such limit

    • @ahmad-murery
      @ahmad-murery Před měsícem

      @@aarondfrancis I see 👍

  • @pedropinho2575
    @pedropinho2575 Před měsícem

    master class

  • @amalebu
    @amalebu Před měsícem

    watch this many time but when i tried it out,
    i add request_header - host: local.test
    ngrok auto redirect to local.test
    with status 301 Moved Permanently
    can you help pls :(

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      Does it load in the browser when you just hit local.test? Before you do any ngrok stuff?

    • @amalebu
      @amalebu Před měsícem

      @@aarondfrancis thank you for reply. but after do that ngrok stuff like on this video at 03:52 , then access ngrok link, browser automatically redirect to local.test again.

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      @@amalebu Right, I'm trying to help you debug. Start with the easy steps.
      1) does it work without ngrok?
      2) does any other site work with ngrok?
      3) can you spin up a brand new app to see if it works there? maybe it's your app?
      I'd go down that road. good luck!

    • @amalebu
      @amalebu Před měsícem

      @aarondfrancis thank you very much for always replying and give solutions.. cant wait for more videos from you. Big thanks

  • @i_Amazin_
    @i_Amazin_ Před měsícem

    This man runs ublock origin AND adblock plus. Impenetrable :'D

  • @khanra17
    @khanra17 Před měsícem

    Any reason for using ngrok over built-in expose?

    • @aarondfrancis
      @aarondfrancis  Před měsícem

      The config file so I can route vite and Laravel

  • @thejonte
    @thejonte Před měsícem

    why not just use your lan?

    • @aarondfrancis
      @aarondfrancis  Před měsícem

      Cause I also need to share with my coworker who lives in a different state!

  • @InSaneRoGer112003
    @InSaneRoGer112003 Před měsícem

    or just use vscode port forwarding ??

  • @eat_things
    @eat_things Před měsícem

  • @kirayamato6128
    @kirayamato6128 Před měsícem

    i loveyou Aaron

  • @Vichion
    @Vichion Před měsícem

    Since you have to configure apache/nginx if you wanna host bare-metal or via VPS, learning how to config access via your own network is a really good lesson.
    all these 3rd party ways just make you less capable of handling stuff on your own.

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      I got exactly the outcome I was looking for... what do you mean I'm not capable of doing it on my own? What do you want from me!

    • @Vichion
      @Vichion Před měsícem

      @aarondfrancis I have no intention of causing any harm or conflict. I simply wanted to share my perspective on using third-party "do it for you" tools in software development.
      I understand that for solo developers or small teams handling multiple aspects of a project, taking shortcuts may seem appealing. However, I believe that this approach can hinder your learning and understanding of the actual deployment process. Once a project is in production, it cannot rely solely on local development environments and temporary solutions like ngrok.
      By avoiding shortcuts, you can acquire and retain the skills necessary to properly maintain your project in the long run. Of course, if you are solely responsible for the Laravel development and others handle other aspects, then using these tools can be beneficial.
      I apologize if my previous comment came across as snarky or disrespectful. That was not my intention.

    • @aarondfrancis
      @aarondfrancis  Před měsícem

      Sure, no problem. This is just a way to share a local only project. Ngrok is the easiest way to expose my local machine to the public internet. It's completely separate from the deployment process or even anything related to production. Ngrok (or their friends) is the best tool for the job. I don't even know how I'd route a domain to my local machine without them.

    • @Vichion
      @Vichion Před měsícem

      @aarondfrancis To launch an Apache or Nginx server and point a domain to it, install the web server on your machine, configure the server settings, ensure the server is running, then update your domain's DNS A-record to point to your server's IP address. I'd say that it's easier than what this video takes you through if the server configuration is omitted 😅
      I set up my own dev server for free on oracle using this method. There is no need to use my local machine anymore when I dev, which feels so good 😎

    • @aarondfrancis
      @aarondfrancis  Před měsícem +1

      But I want to use my local machine. That's what you're missing. I know how to use a server. I know how to deploy! I know how to set up nginx. I want to serve it from my Macbook so I can debug things locally with my business partner who lives far away.

  • @lahirulhr
    @lahirulhr Před měsícem

    Great video Aaron. learned many new things