Files
turso/examples/javascript/database-wasm-vite
dependabot[bot] 4bcfbbc613 build(deps-dev): bump postcss in /examples/javascript/database-wasm-vite
Bumps [postcss](https://github.com/postcss/postcss) from 8.5.6 to 8.5.13.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.5.6...8.5.13)

---
updated-dependencies:
- dependency-name: postcss
  dependency-version: 8.5.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-03 06:06:05 +00:00
..
2026-04-07 11:13:01 +03:00

database-wasm-vite

This is a minimal example showing how to use @tursodatabase/database-wasm in the browser with Vite.


Usage

npm install
npm run dev
# or build assets and serve them with simple node.js server
npm run build
npm run serve

Important: COOP / COEP Headers

Because @tursodatabase/database-wasm relies on SharedArrayBuffer, you need Cross-Origin headers in development and production:

Vite dev server config (vite.config.js)

import { defineConfig } from 'vite'

export default defineConfig({
  server: {
    headers: {
      'Cross-Origin-Opener-Policy': 'same-origin',
      'Cross-Origin-Embedder-Policy': 'require-corp',
    }
  }
})

Static production server (server.mjs)

When serving the dist/ build, also make sure your server sets these headers:

res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");

Vercel deployment

If you deploy to Vercel, add a vercel.json file to ensure COOP / COEP headers are set:

{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "Cross-Origin-Opener-Policy", "value": "same-origin" },
        { "key": "Cross-Origin-Embedder-Policy", "value": "require-corp" }
      ]
    }
  ]
}