forked from quoid/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
34 lines (31 loc) · 1.04 KB
/
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
34
import {defineConfig} from "vite";
import {svelte} from "@sveltejs/vite-plugin-svelte";
// [inline-svg]
// TODO: remove this once vite resolved issue
// https://github.com/vitejs/vite/issues/1204
// import fs from "fs";
// import svgpkg from "svg-inline-loader";
// export function svgInline() { // custom plugin
// return {
// name: "transform-file",
// transform(code, id) {
// if (id.endsWith(".svg")) {
// const svg = fs.readFileSync(id, "utf8");
// const ret = svgpkg.getExtractedSVG(svg, {});
// return `export default '${ret}'`;
// }
// }
// };
// }
// [inline-svg]
// NOW: use `?raw` suffix import svg assets as inline
// https://vitejs.dev/guide/assets.html#importing-asset-as-string
// [autoprefixer]
// https://vitejs.dev/guide/features.html#postcss
// have config with `.postcssrc.json` file
// about `missing peer postcss` error, ignore it
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
base: "./"
});