fix: re-ajouter import map onnxruntime-web pour détourage IA CDN

This commit is contained in:
2026-06-09 14:54:29 +02:00
parent 415b7db643
commit 071f126244
+18
View File
@@ -13,6 +13,24 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="fr">
<head>
{/* Import map requis par @imgly/background-removal chargé depuis CDN.
Doit être placé avant tout script module — Next.js le respecte car
le layout est rendu côté serveur avant injection des chunks. */}
<script
type="importmap"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: JSON.stringify({
imports: {
'onnxruntime-web': 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.21.0/dist/ort.all.min.mjs',
'onnxruntime-web/webgpu': 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.21.0/dist/ort.webgpu.min.mjs',
'onnxruntime-web/wasm': 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.21.0/dist/ort.wasm.min.mjs',
},
}),
}}
/>
</head>
<body className={inter.className}>
<SessionProvider>{children}</SessionProvider>
</body>