From 6ffa24b4b86a921d9554aa23dde597cced955b24 Mon Sep 17 00:00:00 2001 From: "Luna D." Date: Mon, 10 Jun 2024 21:17:06 +0200 Subject: [PATCH] fix vite on external devices --- assets/vite.config.ts | 4 ++++ lib/philomena_web/templates/layout/app.html.slime | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/vite.config.ts b/assets/vite.config.ts index 3e1d3cd9..3ec68f35 100644 --- a/assets/vite.config.ts +++ b/assets/vite.config.ts @@ -24,6 +24,10 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => { return { publicDir: 'static', plugins: [], + server: { + host: '0.0.0.0', + port: 5173, + }, resolve: { alias: { common: path.resolve(__dirname, 'css/common/'), diff --git a/lib/philomena_web/templates/layout/app.html.slime b/lib/philomena_web/templates/layout/app.html.slime index cfa82d19..8fc29580 100644 --- a/lib/philomena_web/templates/layout/app.html.slime +++ b/lib/philomena_web/templates/layout/app.html.slime @@ -22,8 +22,8 @@ html lang="en" = csrf_meta_tag() = vite_hmr? do - script type="module" src="http://localhost:5173/@vite/client" - script type="module" src="http://localhost:5173/js/app.ts" + script type="module" src="http://#{@conn.host}:5173/@vite/client" + script type="module" src="http://#{@conn.host}:5173/js/app.ts" - else script type="text/javascript" src=~p"/js/app.js" async="async" = render PhilomenaWeb.LayoutView, "_opengraph.html", assigns