tauri icon indicating copy to clipboard operation
tauri copied to clipboard

feat: hot reload dev for static files

Open SOVLOOKUP opened this issue 3 years ago • 12 comments

When I modify the front static file, I hope tauri dev can automatically hot reload.

SOVLOOKUP avatar Jul 07 '21 06:07 SOVLOOKUP

Hey @SOVLOOKUP ! Thanks for this suggestion. We've been talking about it and came to the conclusion we could work on such feature, probably once we've passed the security audit. :smile:

Laegel avatar Jul 08 '21 08:07 Laegel

I use Live server in VSCode to and configure tauri.conf.json to point to the default port of Live server like so 👇

{
    "build": {
        "devPath": "https://localhost:5500"
    }
}

and I don't think tauri should implement a custom live server, almost all programming languages and development environments have their own live server/dev server so it would be pointless to re-implement the same thing again.

vsnthdev avatar Aug 15 '21 04:08 vsnthdev

Yeah Tauri would probably just leverage one of the existing dev servers libraries and expose it to the users. Live server is a very good idea, I think we can close this and reopen if more people request this feature.

lucasfernog avatar Aug 15 '21 20:08 lucasfernog

More people requesting this feature :)

rajbits avatar Sep 24 '21 04:09 rajbits

I use Live server in VSCode to and configure tauri.conf.json to point to the default port of Live server

I use create-react-app which already has it's fast reload - I guess it's the same principle as Live server (is it ?) and still my app is not reloading - do you have a trick for me @vsnthdev ? 😬

arnaudambro avatar Mar 23 '22 14:03 arnaudambro

@arnaudambro Unless manually disabled, create-react-app uses a technology called HMR (Hot module reloading) where only that particular component/function/element is resent through a websocket...

With the Live server VSCode extension, a JavaScript full-page refresh is triggered. Have your tried visiting http://localhost:5500 in your browser to check if reloading is working there?

vsnthdev avatar Mar 23 '22 17:03 vsnthdev

actually it works good now ! I tried a few times before sending this message, not working, but today everything works like a charm... thanks !

arnaudambro avatar Mar 24 '22 18:03 arnaudambro

I am working on vscode, and live server is running, but the window can't move by drag. btw, the titlebar has "data-tauri-drag-region", it works well while 'devPath: "../dist"'.

azwc avatar May 29 '22 14:05 azwc

I am working on vscode, and live server is running, but the window can't move by drag. btw, the titlebar has "data-tauri-drag-region", it works well while 'devPath: "../dist"'.

azwc avatar May 29 '22 14:05 azwc

Just wanted to add, I am using sveltekit for my web framework. It uses Vite to package up the JS and Vite also has HMR which seems to work as long as you point tauri.conf.json at the right devPath as was mentioned for live server.

sl0burn avatar Aug 08 '22 23:08 sl0burn

I also think there should be an out-of-the-box solution that doesn't require additional setup from the user - at least for vanilla html documents.

Perhaps the VS Code extension can provide some interoperability?

ItsCubeTime avatar Sep 08 '22 19:09 ItsCubeTime

This is an incredibly painful workflow. I'm trying to use vanilla js with the new import maps feature, and the build times are incredibly slow since I have to touch build.rs every time.

fny avatar Sep 19 '22 21:09 fny