import { defineConfig } from 'vitest/config' // Build of the Blog Editor custom element (D-16): one ES module entry, // assets/src/blogeditor/index.ts, loaded by the admin SPA as a module script. // It is built like a library entry (exports kept, fixed output names with no // content hash; cabana appends ?v= itself) but through the // application pipeline, because Vite's library mode never minifies // whitespace in ES output. The bundle and its stylesheet are committed under // assets/dist and embedded through admin.go; scripts/check-dist.sh fails // when they are stale. export default defineConfig({ build: { outDir: 'assets/dist', emptyOutDir: true, target: 'es2022', modulePreload: false, copyPublicDir: false, reportCompressedSize: true, rollupOptions: { input: 'assets/src/blogeditor/index.ts', preserveEntrySignatures: 'exports-only', output: { format: 'es', entryFileNames: 'blogeditor.js', chunkFileNames: 'blogeditor-[name].js', assetFileNames: 'blogeditor[extname]', inlineDynamicImports: true, }, }, }, test: { environment: 'happy-dom', include: ['tests/**/*.test.ts'], // Tests never reach the network: happy-dom must not load the pages of // iframes (the preview frame's srcdoc holds test payloads with remote // URLs). environmentOptions: { happyDOM: { settings: { disableIframePageLoading: true } }, }, }, })