You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
2 years ago
|
import svelte from '@svitejs/vite-plugin-svelte';
|
||
|
import windiCSS from 'vite-plugin-windicss';
|
||
|
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: [
|
||
|
windiCSS({
|
||
|
//@ts-ignore
|
||
|
verbose: true,
|
||
|
silent: false,
|
||
|
debug: true,
|
||
|
config: 'tailwind.config.js', // tailwind config file path (optional)
|
||
|
compile: false, // false: interpretation mode; true: compilation mode
|
||
|
prefix: 'windi-', // set compilation mode style prefix
|
||
|
globalPreflight: true, // set preflight style is global or scoped
|
||
|
globalUtility: true // set utility style is global or scoped
|
||
|
}),
|
||
|
svelte({
|
||
|
//@ts-ignore
|
||
|
hot: !isProduction,
|
||
|
emitCss: true,
|
||
|
extensions: [ '.md', '.svx', '.svelte' ],
|
||
|
preprocess: [
|
||
|
//
|
||
|
]
|
||
|
}),
|
||
|
indexReplace()
|
||
|
]
|
||
|
};
|
||
|
});
|