A Vite plugin (v0.1.6, actively maintained) that enables cross-origin isolation for the Vite dev server by setting the required COOP and COEP headers. This is necessary for using SharedArrayBuffer and other APIs that require a cross-origin isolated context, such as performance.measureMemory(). The plugin is lightweight and easy to use, simply adding it to the Vite plugins array. It is specifically designed for development environments; for production, server-level configuration is still needed. It is the go-to solution for Vite projects needing SharedArrayBuffer support during development.
npm install vite-plugin-cross-origin-isolationVerified import paths — ran on the pinned version, not inferred.
Setup vite-plugin-cross-origin-isolation in Vite config to enable SharedArrayBuffer during development.
Configure your production server to send 'Cross-Origin-Opener-Policy: same-origin' and 'Cross-Origin-Embedder-Policy: require-corp'.
Ensure all external resources include 'Cross-Origin-Resource-Policy: cross-origin' or proper CORS headers.
For production cross-origin isolation, set headers at your reverse proxy or CDN.
Add the plugin to your Vite config: import crossOriginIsolation from 'vite-plugin-cross-origin-isolation' and include crossOriginIsolation() in plugins.
Update the external resource server to include 'Cross-Origin-Resource-Policy: cross-origin' header or proxy the resource through your own domain.
No dependency data recorded yet.