Files
sm-seo-plugin/vite.config.ts

36 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vitest/config'
// Build of the SEO field elements (E1 golem15-seo-text, E2
// golem15-seo-robots, E3 golem15-seo-serp, E7 golem15-seo-image): one ES
// module entry, assets/src/elements/index.ts, loaded by the admin SPA as a
// module script through the SEO field types' Scripts. Fixed output names
// with no content hash (cabana appends ?v=<sha256 prefix> itself), built
// through the application pipeline so the output is minified. The bundle
// and its stylesheet are committed under assets/dist and embedded through
// field_types.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/elements/index.ts',
preserveEntrySignatures: 'exports-only',
output: {
format: 'es',
entryFileNames: 'seo.js',
chunkFileNames: 'seo-[name].js',
assetFileNames: 'seo[extname]',
inlineDynamicImports: true,
},
},
},
test: {
environment: 'happy-dom',
include: ['tests/**/*.test.ts'],
},
})