I change the nginx config web root to just /web because I don’t install it under /bedrock root /www/kinsta/public/sage-latest/web;
Install Sage theme: Navigate into the themes dir cd /web/app/themes/ and install dev-main: composer create-project roots/sage sage-dev-main dev-main
cd sage-dev-main && npm install && npm run build and enable new theme.
My Issue
Run npm run dev and in the output I see APP_URL: undefined but it is running correctly at http://sage-latest.local/. What port is hot reloading on?
> dev
> vite
VITE v6.0.11 ready in 249 ms
➜ Local: http://localhost:5173/app/themes/sage/public/build/
➜ Network: use --host to expose
➜ press h + enter to show help
LARAVEL plugin v1.2.0
➜ APP_URL: undefined
When I add this change to the app.css file if I manually reload, the site it does reflect the css change, but hot reloading does not work.
There may be a better way to handle this for bedrock setups, but this vite config seems to work if you want to define your APP_URL in your bedrock .env:
I didn’t notice APP_URL was undefined but I get that too. In my case, it doesn’t seem to matter though. If I go to my test site at http://sage.test hot reloading works as expected without any extra configuration.
There’s no docs just yet, but a proper Sage 11 pre-release is high on our list of priorities right now.
Thank you for such a detailed topic. Using the dev version and reporting issues/providing feedback like this is very helpful for everyone.
Like @Log1x, I don’t need to define APP_URL for HMR to work, but both you and @csorrentino at a minimum are needing it for whatever reason. I’ve made a note to mention it in the docs, but maybe we can figure out a better solution.
Apologies for adding to the confusion. It looks like I also don’t need to have it defined for hot reloading to work with my dev setup (Valet). I guess I immediately tried to resolve the console message without realizing it’s a non-issue for me.
This helped my installation, fixed resolving fonts and fixing hot reload. Thanks! I think this should be added to the docs, to prevent APP_URL to be undefined.
I did not take my local env in consideration of being an issue, because when I develop one of my Laravel application (which also uses Vite), there is now extra configuration needed. But I run my local env with DDEV, so basically Docker.
I’ve only tested a Docker (Lando) setup so far with running the build from a container, but if setting the APP_URL allows the build to work on your host machine then that’s helpful to know — thank you.
This works, thanks!
Anyway is there a solution to make it also work on the network?
It’s telling me this is the url to connect in local network http://10.0.0.15:5173
but it’s not working.