1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Switch to vite-string-plugin (#25762)

Switch to
[`vite-string-plugin`](https://github.com/silverwind/vite-string-plugin)
to load SVGs as string during tests. The plugin will also be useful once
we switch to vite.
This commit is contained in:
silverwind
2023-07-08 06:56:12 +02:00
committed by GitHub
parent 6375419468
commit 62f3c0fe76
3 changed files with 12 additions and 39 deletions

View File

@@ -1,20 +1,6 @@
import {defineConfig} from 'vitest/dist/config.js';
import {readFile} from 'node:fs/promises';
import {dataToEsm} from '@rollup/pluginutils';
import {extname} from 'node:path';
import vue from '@vitejs/plugin-vue';
function stringPlugin() {
return {
name: 'string-plugin',
enforce: 'pre',
async load(id) {
const path = id.split('?')[0];
if (extname(path) !== '.svg') return null;
return dataToEsm(await readFile(path, 'utf8'));
}
};
}
import {stringPlugin} from 'vite-string-plugin';
export default defineConfig({
test: {