import svelte from '@sveltejs/vite-plugin-svelte'; import { minify } from 'html-minifier'; import { defineConfig } from 'vite'; // const indexReplace = () => { return { name: 'html-transform', transformIndexHtml(html) { return minify(html, { collapseWhitespace: true }); } }; }; export default defineConfig(({ command, mode }) => { const isProduction = mode === 'production'; return { // base: './', build: { polyfillDynamicImport: false, cssCodeSplit: false, minify: isProduction }, plugins: [ svelte({ //@ts-ignore hot: !isProduction, emitCss: true, extensions: [ '.md', '.svx', '.svelte' ], preprocess: [ // ] }), indexReplace() ] }; });