Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

vite.config.ts 714 B

You have to be logged in to leave a comment. Sign In
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
  1. import { sveltekit } from "@sveltejs/kit/vite";
  2. import { defineConfig, type PluginOption } from "vite";
  3. import Icons from "unplugin-icons/vite";
  4. import { promises } from "fs";
  5. // used to load fonts server side for thumbnail generation
  6. function loadTTFAsArrayBuffer(): PluginOption {
  7. return {
  8. name: "load-ttf-as-array-buffer",
  9. async transform(_src, id) {
  10. if (id.endsWith(".ttf")) {
  11. return `export default new Uint8Array([
  12. ${new Uint8Array(await promises.readFile(id))}
  13. ]).buffer`;
  14. }
  15. },
  16. };
  17. }
  18. export default defineConfig({
  19. plugins: [
  20. sveltekit(),
  21. Icons({
  22. compiler: "svelte",
  23. }),
  24. loadTTFAsArrayBuffer(),
  25. ],
  26. optimizeDeps: {
  27. include: ["browser-image-resizer", "uuid"],
  28. },
  29. });
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...