Files
parenthese/tools/layout-bench/hooks.mjs
T
IliesAllaliandClaude Opus 5 e8e2485dcd Parenthèse
Galaxie familiale : personnes, unions et filiations, photos, vidéos et voix sur chaque personne,
partage par lien avec consultation sans compte et contributions validées par le propriétaire.
Auto-hébergeable avec Docker. Licence PolyForm Noncommercial 1.0.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-14 15:49:05 +02:00

15 lines
649 B
JavaScript

// Resolver : imports relatifs sans extension (style Vite) → .js / .jsx / index.js
import { existsSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
export async function resolve(specifier, context, nextResolve) {
if ((specifier.startsWith('./') || specifier.startsWith('../')) && !/\.[a-z]+$/i.test(specifier) && context.parentURL) {
const base = new URL(specifier, context.parentURL)
for (const ext of ['.js', '.mjs', '.jsx', '/index.js']) {
const candidate = base.href + ext
if (existsSync(fileURLToPath(candidate))) return nextResolve(candidate, context)
}
}
return nextResolve(specifier, context)
}