diff --git a/CHANGELOG.md b/CHANGELOG.md index 48be014f..a78ea7ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to ## [Unreleased] +### Fixed + +- 🐛(frontend) serve MediaPipe assets under a versioned path + ## [1.25.1] - 2026-08-06 ### Fixed diff --git a/src/frontend/src/features/rooms/livekit/components/blur/index.ts b/src/frontend/src/features/rooms/livekit/components/blur/index.ts index e6399f83..6d025915 100644 --- a/src/frontend/src/features/rooms/livekit/components/blur/index.ts +++ b/src/frontend/src/features/rooms/livekit/components/blur/index.ts @@ -10,7 +10,7 @@ export const SELFIE_SEGMENTER_MODEL_PATH = export const FACE_LANDMARKS_MODEL_PATH = '/assets/mediapipe/models/face_landmarker.task' -export const MEDIAPIPE_PATH_WASM = '/assets/mediapipe/wasm' +export const MEDIAPIPE_PATH_WASM = `/assets/mediapipe/wasm/${__MEDIAPIPE_VERSION__}` export enum ProcessorType { BLUR = 'blur', diff --git a/src/frontend/src/vite-env.d.ts b/src/frontend/src/vite-env.d.ts index c7205443..0fe1fb43 100644 --- a/src/frontend/src/vite-env.d.ts +++ b/src/frontend/src/vite-env.d.ts @@ -1,4 +1,8 @@ /// + +// Version of @mediapipe/tasks-vision, injected at build time (vite.config.ts). +declare const __MEDIAPIPE_VERSION__: string + interface ImportMetaEnv { readonly VITE_API_BASE_URL: string readonly VITE_APP_TITLE: string diff --git a/src/frontend/vite.config.ts b/src/frontend/vite.config.ts index 241dc98c..f29fd306 100644 --- a/src/frontend/vite.config.ts +++ b/src/frontend/vite.config.ts @@ -1,13 +1,27 @@ +import { readFileSync } from 'node:fs' import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' import { visualizer } from 'rollup-plugin-visualizer' import svgr from 'vite-plugin-svgr' import { viteStaticCopy } from 'vite-plugin-static-copy' +const mediapipeVersion: string = JSON.parse( + readFileSync( + new URL( + './node_modules/@mediapipe/tasks-vision/package.json', + import.meta.url + ), + 'utf-8' + ) +).version + // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()) return { + define: { + __MEDIAPIPE_VERSION__: JSON.stringify(mediapipeVersion), + }, plugins: [ react(), svgr({ @@ -23,7 +37,7 @@ export default defineConfig(({ mode }) => { targets: [ { src: 'node_modules/@mediapipe/tasks-vision/wasm/*', - dest: 'assets/mediapipe/wasm', + dest: `assets/mediapipe/wasm/${mediapipeVersion}`, rename: { stripBase: 4 }, }, {