Metabolism: browser fix — the arena stays a plain ArrayBuffer unless a region pool will share it; vite serves cross-origin-isolation headers so the browser can opt into SAB

This commit is contained in:
Dejvino
2026-10-28 15:33:07 +01:00
parent d6e97a2b52
commit cfc0bddb1f
2 changed files with 25 additions and 1 deletions
+16
View File
@@ -142,4 +142,20 @@ function songBankPlugin() {
export default defineConfig({
plugins: [songBankPlugin()],
// Cross-origin isolation: browsers expose SharedArrayBuffer only when
// both headers are present. The region pool needs it once the sim runs
// inside a browser worker; the demo is fully same-origin, so requiring
// corp costs nothing here.
server: {
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
},
preview: {
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
},
});