mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-07 09:23:38 +00:00
🐛(frontend) serve MediaPipe assets under a versioned path
The MediaPipe assets were served under /assets, where the cache behavior differs between wasm and js files. As a result, clients could end up with a fresh js loader paired with a stale wasm binary (or vice versa), leaving MediaPipe out of sync. Copy the assets under a versioned route so the URL changes whenever the dependency version bumps. Clients then reload both the js and the wasm together, keeping them in sync.
This commit is contained in:
committed by
aleb_the_flash
parent
41e937c1f1
commit
f3626a2dc6
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
Vendored
+4
@@ -1,4 +1,8 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
// 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
|
||||
|
||||
@@ -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 },
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user