Anki/ts/vite.config.ts
RumovZ 790c52f012
Svg icon (#3135)
* Add sveltekit-svg plugin to fix svg icon styling

Closes #3127.

* Unify svg icon usage

Moves all icons into ts/lib/components/icons.ts and uses a single component to render
them both with eslint and svelte-kit.

* Fix spinning revert icon not being centered

* Use svg earth icon for global label

* Add tooltip to global label icon

* Remove eslint-plugin-simple-import-sort

Imports are already sorted by dprint with conflicting rules.
2024-04-24 02:37:31 +01:00

52 lines
1.6 KiB
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import svg from "@poppanator/sveltekit-svg";
import { sveltekit } from "@sveltejs/kit/vite";
import { realpathSync } from "fs";
import { defineConfig } from "vite";
const configure = (proxy: any, _options: any) => {
proxy.on("error", (err: any) => {
console.log("proxy error", err);
});
proxy.on("proxyReq", (proxyReq: any, req: any) => {
console.log("Sending Request to the Target:", req.method, req.url);
});
proxy.on("proxyRes", (proxyRes: any, req: any) => {
console.log("Received Response from the Target:", proxyRes.statusCode, req.url);
});
};
export default defineConfig({
plugins: [sveltekit(), svg({})],
test: {
include: ["**/*.{test,spec}.{js,ts}"],
cache: {
// prevent vitest from creating ts/node_modules/.vitest
dir: "../node_modules/.vitest",
},
},
build: {
reportCompressedSize: false,
},
server: {
host: "127.0.0.1",
fs: {
// Allow serving files project root and out dir
allow: [
// realpathSync(".."),
// "/home/dae/Local/build/anki/node_modules",
realpathSync("../out"),
// realpathSync("../out/node_modules"),
],
},
proxy: {
"/_anki": {
target: "http://127.0.0.1:40000",
changeOrigin: true,
autoRewrite: true,
configure,
},
},
},
});