Electron Vite

It loads at least.
13 Replies
Ethaks
Ethaks3y ago
Okay, in vite.config.js:
root: ".",
base: "/foundryDev/systems/pf1/",
publicDir: resolve("public"),
server: {
port: 30001,
open: true,
proxy: {
"^(?!/foundryDev/systems/pf1)": "http://localhost:30000/",
"/foundryDev/socket.io": {
target: "ws://localhost:30000",
root: ".",
base: "/foundryDev/systems/pf1/",
publicDir: resolve("public"),
server: {
port: 30001,
open: true,
proxy: {
"^(?!/foundryDev/systems/pf1)": "http://localhost:30000/",
"/foundryDev/socket.io": {
target: "ws://localhost:30000",
Mana
Mana3y ago
Was just doing those on my own :p
Ethaks
Ethaks3y ago
The console should then have an entry [vite] connected. Somewhere at the top, a little below the Foundry logo
Mana
Mana3y ago
It's there, yeah.
Ethaks
Ethaks3y ago
Or at least a [vite] connecting... almost at the top of the log. Looks like the template reloading suffers when a routePrefix is added though
Mana
Mana3y ago
If it fails to detect the prefix, then yeah, it wouldn't find things correctly.
Ethaks
Ethaks3y ago
Since it relies on base, which should not include the routePrefix within Foundry. Welp, that I can work with though.
Mana
Mana3y ago
The page launched by the serve command in browser also lacks the prefix, so it kinda just splats on 404 or similar.
Ethaks
Ethaks3y ago
The whole setup is absolutely not built with a routePrefix in mind 😄
Mana
Mana3y ago
Not that I ever use that, since it launches firefox for me, which is there just to not mess my tabs in the browser I actually use.
Ethaks
Ethaks3y ago
This will require some tinkering, but I think adding an option to foundryconfig.json and then handling base and its dependants accordingly should be quite possible.
Mana
Mana3y ago
While at it, could you add option to not open it in a browser?
Ethaks
Ethaks3y ago
Yep, might as well I added routePrefix handling to the lang-reload branch as that one already included some tooling changes. It should now be possible to have a foundryconfig.json file like
{
"routePrefix": "foundryDev"
}
{
"routePrefix": "foundryDev"
}
and get a working Vite development server including template hot reloading. openBrowser is a boolean option, but I set the default to false so you should not need to manually set it.