-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
vite.config.ts
66 lines (63 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
import { resolve } from "node:path"
import { defineConfig, loadEnv } from "vite"
import laravel from "laravel-vite-plugin"
import tsconfigPaths from "vite-tsconfig-paths"
import svgSprite from "vite-svg-sprite-wrapper"
import tailwind from "@tailwindcss/vite"
import inject from "@rollup/plugin-inject"
import browserslist from "browserslist"
import { browserslistToTargets } from "lightningcss"
import { browserslist as browserslistConfig } from "./package.json"
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "")
return {
base: mode === "development" ? "/" : "/dist/",
build: {
outDir: resolve(__dirname, "public/dist"),
emptyOutDir: true,
manifest: "manifest.json",
cssMinify: "lightningcss"
},
plugins: [
// this plugin is necessary for our HTMX extensions to correctly register
inject({
htmx: "htmx.org"
}),
svgSprite({
sprite: {
shape: {
transform: [
{
svgo: {
plugins: [{ name: "preset-default" }, "removeXMLNS"]
}
}
]
}
},
icons: "assets/icons/*.svg",
outputDir: "assets/"
}),
laravel({
input: ["src/index.ts", "src/styles/index.css", "src/styles/panel.css"],
refresh: ["site/{layouts,snippets,templates}/**/*"]
}),
tsconfigPaths(),
tailwind()
],
css: {
transformer: "lightningcss",
lightningcss: {
targets: browserslistToTargets(browserslist(browserslistConfig))
}
},
server: {
origin: env.APP_URL,
port: Number(env.VITE_DEV_PORT || 3000),
proxy: {
// we proxy anything except the folders our vite dev assets are in
"^(?!/src|/node_modules|/@vite|/@react-refresh|/assets).*$": `http://${env.KIRBY_DEV_HOSTNAME}:${env.KIRBY_DEV_PORT}`
}
}
}
})