-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
33 lines (30 loc) 路 903 Bytes
/
vite.config.js
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
import { defineConfig } from "vite";
import Pages from "vite-plugin-pages";
import ViteSvgLoader from "vite-svg-loader";
import Vue from "@vitejs/plugin-vue";
import { breakpoints } from "./src/helpers/constants";
const breakpointsString = Object.entries(breakpoints).reduce(
(str, [name, value]) =>
str + `$breakpoint-${name.toLowerCase()}: ${value}px;`,
""
);
/** @type {import('vite').UserConfig} */
export default defineConfig({
plugins: [
{
name: "remove-swiper",
transform(code, id, options = {}) {
if (options.ssr)
return code.replace(/import .swiper\/(s?css|less).*$/gm, "");
},
},
Vue(),
Pages(),
ViteSvgLoader(),
],
ssgOptions: {
script: "async",
formatting: process.env.NODE_ENV === "production" ? "minify" : "prettify",
},
css: { preprocessorOptions: { scss: { additionalData: breakpointsString } } },
});