Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Service worker (custom Astro integration) #242

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +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';

const productionUrl = `https://${ pkg.name }.pages.dev`; // overwrite if you have a custom domain
const localhostPort = 4323; // 4323 is "head" in T9
Expand Down Expand Up @@ -50,7 +51,10 @@ export default defineConfig({
// @see https://docs.astro.build/en/guides/images/#configure-no-op-passthrough-service
service: passthroughImageService()
},
integrations: [sitemap()],
integrations: [
sitemap(),
serviceWorker()
],
output: isPreview ? 'server' : 'static',
server: { port: localhostPort },
site: siteUrl,
Expand Down
Loading
Loading