import { defineConfig } from 'vite'; // Builds two CSS entries with no plugin in the graph, isolating Vite's own bundled postcss-import, // whose `skipDuplicates` option is the mechanism docs/plans/material-3-alignment.md's "Tailwind's // footprint" paragraph measured and StylesheetsBundleTest.php pins: resources/css/all.css, and // tests/Fixtures/dedup-app.css, an application-shaped entry importing per-component stylesheets // that share button.css. A stylesheet several files import lands once per entry, at its first // position. // // Not the Workbench's config: `@tailwindcss/vite` inlines the imports of any entry that uses // Tailwind itself, without that deduplication, so a shared stylesheet repeats there. The Workbench // keeps the package's CSS in an entry of its own (workbench/resources/css/package.css) for that // reason, until plan step 39 removes Tailwind. // // DEDUP_OUT_DIR is required: the test builds into a temporary directory and deletes it, and nothing // should land in the package's own tree, least of all workbench/public/build. if (!process.env.DEDUP_OUT_DIR) { throw new Error('Set DEDUP_OUT_DIR to the directory the dedup fixture should build into.'); } export default defineConfig({ publicDir: false, build: { outDir: process.env.DEDUP_OUT_DIR, emptyOutDir: true, manifest: true, rollupOptions: { input: ['resources/css/all.css', 'tests/Fixtures/dedup-app.css'], }, }, logLevel: 'silent', });