From 90b4ee8915f46e9e71073bb954ddc449363eb7a8 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 c677a7ff..9342c889 100644 --- a/assets/vite.config.ts +++ b/assets/vite.config.ts @@ -28,6 +28,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 996a3727..105b9b76 100644 --- a/lib/philomena_web/templates/layout/app.html.slime +++ b/lib/philomena_web/templates/layout/app.html.slime @@ -24,8 +24,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