Package Exports
- vite-string-plugin
Readme
vite-string-plugin
Vite plugin to import files as string, with zero dependencies
Usage
vite.config.js
import {defineConfig} from "vite";
import {stringPlugin} from "vite-string-plugin";
export default defineConfig({
plugins: [
stringPlugin(),
],
});file.js
import foo from "./foo.svg";Options
match: Regex to match the path against. Default:/\.(svg|md|xml)$/i.
Typescript
Add these to your ambient type declarations:
declare module "*.svg" {
const value: string;
export default value;
}
declare module "*.md" {
const value: string;
export default value;
}
declare module "*.xml" {
const value: string;
export default value;
}