This repository has been archived by the owner on Jul 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
vite.config.ts
69 lines (64 loc) · 1.73 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { resolve } from "path";
import svelte from "@svitejs/vite-plugin-svelte";
import windiCSS from "vite-plugin-windicss";
import { minify } from "html-minifier";
import { mdsvex }from 'mdsvex';
import slug from 'remark-slug';
// const { defineConfig } = require("vite");
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 {
build: {
polyfillDynamicImport: false,
cssCodeSplit: false,
minify: isProduction,
},
optimizeDeps: {
exclude: ["@roxi/routify"],
},
resolve: {
dedupe: ['@roxi/routify'],
alias: {
svelte: resolve(__dirname, "node_modules/svelte"),
'@': resolve(__dirname, './src')
},
},
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: [
mdsvex({
remarkPlugins: [slug],
extension: 'md',
}),
],
}),
indexReplace(),
],
};
});