vite-plugin-raw will transform any type file to string
npm install -D vite-plugin-raw
import vitePluginRaw from 'vite-plugin-raw';
const path = require('path');
module.exports = {
plugins: [
vitePluginRaw({
match: /\.svg$/,
exclude: [new RegExp(path.resolve(__dirname, './src/assets'))]
})
]
}
or
import richtextRedo from '../assets/richtext_redo.svg?raw';