import { defineConfig } from 'vite'; import { realpathSync } from 'node:fs'; import { resolve } from 'node:path'; // The test suite validates against soundbox (a sibling checkout, the vault // layout), whose sources reach numbl's compiler internals through a // `numbl-src` alias; mirror it so those sources load here too. The page // itself uses neither. const soundbox = resolve(import.meta.dirname, '../soundbox'); let numblSrc: string | null = null; try { numblSrc = realpathSync(resolve(soundbox, 'node_modules/numbl/src')); } catch { // No soundbox checkout: the app still builds; only the tests need it. } export default defineConfig({ base: './', resolve: { alias: numblSrc ? { 'numbl-src': numblSrc } : {}, }, server: { fs: { allow: [import.meta.dirname, ...(numblSrc ? [soundbox, numblSrc] : [])] }, }, build: { target: 'es2022' }, });