import { defineConfig } from "vite"; import stylex from "@stylexjs/unplugin"; export default defineConfig({ plugins: [ stylex.vite({ useCSSLayers: true, }), ], optimizeDeps: { include: [ // recharts imports `Decimal from "decimal.js-light"`, but the package // has no `exports` field (only main/module), so Vite's lazy dep // optimizer can pre-bundle the CJS build with broken interop // (`import_decimal.default is not a constructor` on chart ticks). // Pre-bundling it up front fixes it. "decimal.js-light", // wterm's sub-packages (@wterm/core, @wterm/dom) are peer deps of // @wterm/react. Vite's dep optimizer doesn't pick them up on first // load, causing 404s for the on-demand bundled chunks. Pre-bundle // all three explicitly. "@wterm/core", "@wterm/dom", "@wterm/react", ], }, });