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:
@@ -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',
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user