From e337fc90f812a232c4fd56daaebff8360e4680a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= Date: Fri, 12 Apr 2024 08:54:11 +0200 Subject: [PATCH] fix: Make all network requests go through for Fresh server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make a config available to both `main.ts` and `dev.ts`. Should fix issue with long loading times and failed network requests. References: https://github.com/denoland/fresh/issues/1678 Signed-off-by: Tim HÄrek Andreassen --- dev.ts | 5 ++--- fresh.config.ts | 7 +++++++ main.ts | 6 ++---- 3 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 fresh.config.ts diff --git a/dev.ts b/dev.ts index 2d85d6c..e81b1e0 100755 --- a/dev.ts +++ b/dev.ts @@ -1,5 +1,4 @@ -#!/usr/bin/env -S deno run -A --watch=static/,routes/ - import dev from "$fresh/dev.ts"; +import config from "./fresh.config.ts"; -await dev(import.meta.url, "./main.ts"); +await dev(import.meta.url, "./main.ts", config); diff --git a/fresh.config.ts b/fresh.config.ts new file mode 100644 index 0000000..e00d557 --- /dev/null +++ b/fresh.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from "$fresh/server.ts"; +import twindPlugin from "$fresh/plugins/twindv1.ts"; +import twindConfig from "./twind.config.ts"; + +export default defineConfig({ + plugins: [twindPlugin(twindConfig)], +}); diff --git a/main.ts b/main.ts index e3a52ce..3494871 100644 --- a/main.ts +++ b/main.ts @@ -1,7 +1,5 @@ import { start } from "$fresh/server.ts"; import manifest from "./fresh.gen.ts"; +import config from "./fresh.config.ts"; -import twindPlugin from "$fresh/plugins/twindv1.ts"; -import twindConfig from "./twind.config.ts"; - -await start(manifest, { plugins: [twindPlugin(twindConfig)] }); +await start(manifest, config);