/ concept-collection / turing-sphere-2
Sign in
concept-collection / turing-sphere-2
turing-sphere-2 / vite.config.ts
31 lines · 1.1 KBBlameHistoryRaw
1import { defineConfig } from 'vite';
2import { resolve } from 'node:path';
4// numbl is a local `file:` dependency, so node_modules/numbl is a symlink to
5// the sibling checkout. Its package `exports` map only publishes the runtime
6// entry points, not the compiler internals we need (parser + JIT lowering), so
7// we reach them through a path alias. (package.json's `imports` field cannot
8// express this — Node rejects node_modules targets — and plain Node could not
9// resolve numbl's internal `.js`->`.ts` imports anyway, which is why the GPU
10// tests run in the browser harness rather than under `node`.)
11const numblSrc = resolve(import.meta.dirname, 'node_modules/numbl/src');
13export default defineConfig({
14 base: './',
15 resolve: {
16 alias: { 'numbl-src': numblSrc },
17 },
18 server: {
19 // the alias resolves outside the project root (through the symlink)
20 fs: { allow: [import.meta.dirname, numblSrc] },
21 },
22 build: {
23 target: 'es2022',
24 rollupOptions: {
25 input: {
26 main: resolve(import.meta.dirname, 'index.html'),
27 test: resolve(import.meta.dirname, 'test.html'),
28 },
29 },
30 },
31});
moveopenescclose