Plan step 37 review. The Vite test counted each of four files' plain root rule, which the minifier folds into one even when a build repeats the whole stylesheet: it passed against the Workbench's Tailwind entry, which repeated 231 rules. It now asserts that no innermost rule repeats under the same at-rules, which that build fails and a deduplicating one passes, and it builds a second entry shaped like an application's — outside the package, the foundation, then four component stylesheets that each import button.css, and button.css again — where button.css must also keep its first position. The fixture config refuses to run without DEDUP_OUT_DIR, so it never writes into the package tree. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
33 lines
1.5 KiB
JavaScript
33 lines
1.5 KiB
JavaScript
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',
|
|
});
|