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:
@@ -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: {
|
||||
|
Reference in New Issue
Block a user