iterate.com / cloud

git clone https://git.iterate.com/repos/cloud

cloud / internal-packages / installer / vite.config.tsmain at aacbc74

import { existsSync, readFileSync } from "node:fs";
import { cloudflare } from "@cloudflare/vite-plugin";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

// The commits of iterate that the deploy image holds, for the Worker (worker/stack-commits.js).
// container/pack-stack.sh writes the file before a deploy's build. A build with no packed stack
// gets an empty list, and its Worker says nothing about commits on a card.
const commits = new URL("container/stack/COMMITS", import.meta.url);

export default defineConfig({
  plugins: [react(), tailwindcss(), cloudflare()],
  resolve: { dedupe: ["react", "react-dom"] },
  define: {
    __STACK_COMMITS__: JSON.stringify(existsSync(commits) ? readFileSync(commits, "utf8") : ""),
  },
});