/ concept-collection / turing-surface-cache
concept-collection / turing-surface-cache
turing-surface-cache / vite.cli.config.ts
33 lines · 1.1 KBCodeBlameHistory
2 * The command line's bundle: the same source as the page, built for node.
3 *
4 * Everything under src/ is bundled in, numbl's compiler included, exactly as
5 * in the page's build — the published package therefore has no dependency on
6 * a numbl checkout. What stays external is what cannot be bundled: h5wasm,
7 * whose node build reads its wasm off disk, and Dawn, which is a native
8 * addon (and optional, so a machine without it still installs).
9 */
10import { defineConfig, mergeConfig } from 'vite';
11import base from './vite.config.ts';
13export default mergeConfig(
14 base,
15 defineConfig({
16 define: { __NODE_BUILD__: 'true' },
17 build: {
18 ssr: 'src/cli/fill.ts',
19 outDir: 'dist-cli',
20 target: 'node22',
21 emptyOutDir: true,
22 minify: false,
23 rollupOptions: {
24 external: ['h5wasm', 'h5wasm/node', 'webgpu'],
e53205fShow one parameter across its range, not only at a pointJeremy Magland 25 // The page build's two-HTML input would otherwise merge in here;
26 // a string wins over an object in mergeConfig, restoring the one
27 // node entry.
28 input: 'src/cli/fill.ts',
c2317d0Fill the cache from the command line, without a browserJeremy Magland 29 output: { entryFileNames: 'fill.js', banner: '#!/usr/bin/env node' },
30 },
31 },
32 }),
33);