diff --git a/astro.config.ts b/astro.config.ts index a21c0e7..e697dd8 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -5,7 +5,7 @@ import sitemap from '@astrojs/sitemap'; import type { PluginOption } from 'vite'; import { isPreview } from './config/preview'; import pkg from './package.json'; -import serviceWorker from './scripts/service-worker-integration.ts'; +import serviceWorker from './config/astro/service-worker-integration.ts'; const productionUrl = `https://${ pkg.name }.pages.dev`; // overwrite if you have a custom domain const localhostPort = 4323; // 4323 is "head" in T9 diff --git a/scripts/service-worker-integration.ts b/config/astro/service-worker-integration.ts similarity index 87% rename from scripts/service-worker-integration.ts rename to config/astro/service-worker-integration.ts index b723bd0..5f1eb4a 100644 --- a/scripts/service-worker-integration.ts +++ b/config/astro/service-worker-integration.ts @@ -2,8 +2,8 @@ import type { APIRoute, AstroIntegration } from 'astro'; import { fileURLToPath } from 'node:url'; import * as esbuild from 'esbuild'; -const serviceWorkerSrc = fileURLToPath(new URL('../src/assets/service-worker.ts', import.meta.url)); -const serviceWorkerDist = fileURLToPath(new URL('../dist/service-worker.js', import.meta.url)); +const serviceWorkerSrc = fileURLToPath(new URL('../../src/assets/service-worker.ts', import.meta.url)); +const serviceWorkerDist = fileURLToPath(new URL('../../dist/service-worker.js', import.meta.url)); export default function serviceWorkerIntegration(): AstroIntegration { return { @@ -37,6 +37,7 @@ export default function serviceWorkerIntegration(): AstroIntegration { } catch (e) { console.error('Failed to build service worker'); console.error(e); + process.exit(1); } }, },