UNPKG

lc-bun-plugin

Version:
22 lines (20 loc) 618 B
import fs from "fs"; export function bunPluginSvg() { const BunPluginSvg = { name: "import svg as raw string", setup(build) { build.onLoad( { filter: /\.svg$/, namespace: "file" }, async (args) => { const filePath = args.path; const svgCode = fs.readFileSync(filePath, "utf8"); return { contents: svgCode, loader: "text", }; }, ); }, }; return BunPluginSvg; }