- Private ESM package with exact pins: @tiptap/core, pm, starter-kit, extension-table and extension-image 3.31.4; vite 7.3.5, vitest 3.2.7, happy-dom 20.11.6 and typescript 5.9.3, the admin SPA toolchain - vite.config.ts builds assets/src/blogeditor/index.ts into fixed-name assets/dist/blogeditor.js and blogeditor.css, minified, and runs vitest on happy-dom - scripts/check-dist.sh rebuilds into a temp dir and fails when assets/dist is stale; node_modules is ignored
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
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=<sha256 prefix> 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'],
|
|
},
|
|
})
|