lando / laravel

The Official Laravel Lando Plugin
https://docs.lando.dev/laravel/
GNU General Public License v3.0
18 stars 11 forks source link

Any success with setup lando with vite, default frontend framework for laravel ? #24

Open robert-abram opened 2 years ago

robert-abram commented 2 years ago

I'v tried everything, and any of this working my latest config

  node:
    type: node:16
    ssl: true
    scanner: false
    ports:
      - 3009:3009
    build:
      - npm install
    overrides:
      ports:
        - 3009 # Not sure if we need this

and vite.config.js

server: {
        host:true,
        hmr: {
            host: 'vite.lndo.site',
            clientPort: '80',
        },
        port: 3009
    },

Then i run lando npm run dev, to start vite server, but without success

sinnbeck commented 2 years ago

I got it working, but only with http, not https. I added a seperate service for node

  node:
    type: node:16
    ssl: true
    scanner: false
    ports:
      - 3009:3009
    build:
      - npm install

and

tooling:
  dev:
    service: node
    cmd: npm run dev

and my server in vite.config.js

    server: {
        https: false,
        host: true,
        port: 3009,
        hmr: {host: '0.0.0.0'},
    },

If you have any luck getting it working with https, I would be interested in knowing this.

sinnbeck commented 2 years ago

Ok just tried to get https working.. And this time I did!

This is the server block.

    server: {
        https: false,
        host: true,
        port: 3009,
        hmr: {host: 'localhost', protocol: 'ws'},
    },

Even though it is running http/ws, it is using localhost which the browser will allow to work with https on the site itself :)

Wrote a small blog post: https://sinnbeck.dev/posts/getting-vite-and-laravel-to-work-with-lando