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"),
8cbfe83Beam app (step 1): beam with bending, clamped/pinned/cantilever ends, local or Kirchhoff stretching; sped-up note with spectrogram. Note player, mute button, formats and canvas sizing in src/common/Jeremy Magland 21 beam: page("beam/index.html"),
1763884Plate: new app, square simply supported linear plate on a grid (exact sine modes, mallet or kick at a point, height map, sped-up note with spectrogram)Jeremy Magland 22 plate: page("plate/index.html"),
39bccd2Driven plate: new app, rectangular simply supported von Kármán plate driven in one mode (modal force in phase with the mode's velocity, energy-target controller on a log ramp), height map, energy chart, perturbation optionJeremy Magland 23 "driven-plate": page("driven-plate/index.html"),
d1459b9One multi-page Vite site: shared config at the root, landing page, apps at /double-pendulum/ and /fput-chain/Jeremy Magland 24 },
420fab0Shared styles in src/common/style.css; each app's own rules in its style.css, imported afterJeremy Magland 25 // Name the chunk holding src/common/ "common" (otherwise it takes the
26 // name of one of its modules).
27 output: { manualChunks: (id: string) => (id.includes("/src/common/") ? "common" : undefined) },
d1459b9One multi-page Vite site: shared config at the root, landing page, apps at /double-pendulum/ and /fput-chain/Jeremy Magland 28 },
29 },
30});