/ proof-of-concept / instrawave
Sign in
proof-of-concept / instrawave
instrawave / vite.config.ts
26 lines · 872 BBlameHistoryRaw
1import { defineConfig } from 'vite';
2import { realpathSync } from 'node:fs';
3import { resolve } from 'node:path';
5// The test suite validates against soundbox (a sibling checkout, the vault
6// layout), whose sources reach numbl's compiler internals through a
7// `numbl-src` alias; mirror it so those sources load here too. The page
8// itself uses neither.
9const soundbox = resolve(import.meta.dirname, '../soundbox');
10let numblSrc: string | null = null;
11try {
12 numblSrc = realpathSync(resolve(soundbox, 'node_modules/numbl/src'));
13} catch {
14 // No soundbox checkout: the app still builds; only the tests need it.
17export default defineConfig({
18 base: './',
19 resolve: {
20 alias: numblSrc ? { 'numbl-src': numblSrc } : {},
21 },
22 server: {
23 fs: { allow: [import.meta.dirname, ...(numblSrc ? [soundbox, numblSrc] : [])] },
24 },
25 build: { target: 'es2022' },
26});
↑↓ move↵openescclose