d1459b9One multi-page Vite site: shared config at the root, landing page, apps at /double-pendulum/ and /fput-chain/Jeremy Magland 1import { defineConfig } from "vite";
3// One multi-page site: src/index.html (landing page) and one page per app in
4// src/<app>/index.html, served at /<app>/. Shared code goes in src/common/.
5// Relative asset paths, so the build works wherever the site is served
6// (an origin root or a /<collection>/<repo>/site/ path); ES module workers.
7const page = (p: string) => decodeURIComponent(new URL(`./src/${p}`, import.meta.url).pathname);
9export default defineConfig({
10 root: "src",
11 base: "./",
12 worker: { format: "es" },
13 build: {
14 outDir: "../dist",
15 emptyOutDir: true,
16 rolldownOptions: {
17 input: {
18 main: page("index.html"),
19 "double-pendulum": page("double-pendulum/index.html"),
20 "fput-chain": page("fput-chain/index.html"),
21 },
22 },
23 },
24});