diff --git a/pages/src/lib/Primes.svelte b/pages/src/lib/Primes.svelte
index 1e6ba50..d4d3316 100644
--- a/pages/src/lib/Primes.svelte
+++ b/pages/src/lib/Primes.svelte
@@ -93,6 +93,19 @@
{/if}
+
{#if !work}
Press Start to discover primes.
{:else}
diff --git a/pages/src/routes/+page.svelte b/pages/src/routes/+page.svelte
index a9dddd1..022cc82 100644
--- a/pages/src/routes/+page.svelte
+++ b/pages/src/routes/+page.svelte
@@ -23,13 +23,13 @@
diff --git a/pages/vite.config.ts b/pages/vite.config.ts
index 652712c..c2154bc 100644
--- a/pages/vite.config.ts
+++ b/pages/vite.config.ts
@@ -1,15 +1,22 @@
import { sveltekit } from '@sveltejs/kit/vite';
-import { defineConfig } from 'vite';
+import { defineConfig, type ConfigEnv, type PreviewServer, type ViteDevServer } from 'vite';
-export default defineConfig({
- plugins: [sveltekit(), {
- name: "configure-response-headers",
- configureServer: (server) => {
- server.middlewares.use((_req, res, next) => {
- res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
- res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
- next();
- });
- },
- }]
-});
+function crossOriginIsolationMiddleware(server: PreviewServer | ViteDevServer) {
+ server.middlewares.use((_req, res, next) => {
+ res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
+ res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
+ next();
+ });
+}
+
+const withoutCrossOriginIsolation = 'no-coi';
+
+export default function ({ mode }: ConfigEnv) {
+ return defineConfig({
+ plugins: [sveltekit(), {
+ name: "configure-response-headers",
+ configureServer: mode === withoutCrossOriginIsolation ? undefined : crossOriginIsolationMiddleware,
+ configurePreviewServer: mode === withoutCrossOriginIsolation ? undefined : crossOriginIsolationMiddleware,
+ }],
+ });
+};