/ concept-collection / numbl-figure-viewer
Sign in
concept-collection / numbl-figure-viewer
numbl-figure-viewer / vite.config.ts
14 lines · 610 BCodeBlameHistory
a9daa5bnumbl figure viewer: upload a numbl .h5 figure and render it via numbl/graphicsJeremy Magland 1import { defineConfig } from "vite";
2import react from "@vitejs/plugin-react";
4// https://vite.dev/config/
ab35c1fUse a relative base so the build works at any mount pointowner 5// A relative base under `--mode pages`, so the build works wherever it is
6// mounted (a Pages project subpath, or a site root); local dev stays at root.
a9daa5bnumbl figure viewer: upload a numbl .h5 figure and render it via numbl/graphicsJeremy Magland 7export default defineConfig(({ mode }) => ({
ab35c1fUse a relative base so the build works at any mount pointowner 8 base: mode === "pages" ? "./" : "/",
10 // numbl is a linked (file:) dependency, so force a single React instance and
11 // let Vite descend into the linked package to resolve its imports.
12 resolve: { dedupe: ["react", "react-dom"] },
13 optimizeDeps: { exclude: ["numbl"] },
14}));
moveopenescclose