mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
22 lines
508 B
TypeScript
22 lines
508 B
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { defineConfig } from 'vite';
|
|
import fs from 'fs';
|
|
|
|
export default defineConfig({
|
|
plugins: [sveltekit(), rawFonts(['.ttf'])],
|
|
test: {
|
|
include: ['src/**/*.{test,spec}.{js,ts}']
|
|
}
|
|
});
|
|
|
|
function rawFonts(ext) {
|
|
return {
|
|
name: 'vite-plugin-raw-fonts',
|
|
transform(code, id) {
|
|
if (ext.some((e) => id.endsWith(e))) {
|
|
const buffer = fs.readFileSync(id);
|
|
return { code: `export default ${JSON.stringify(buffer)}`, map: null };
|
|
}
|
|
}
|
|
};
|
|
}
|