vite-plugin-svgr icon indicating copy to clipboard operation
vite-plugin-svgr copied to clipboard

Cannot import more than 1 SVG from library, silently hangs indefinitely

Open binaryartifex opened this issue 4 months ago • 1 comments

Im working with an NX monorepo. new Vite app. the important part as follows

    svgr({
      svgrOptions: {
        ref: true,
        typescript: true,
        exportType: "named",
      },
      esbuildOptions: {
        loader: "tsx",
      },
      include: "**/*.svg",
    }),

i have a library that is consumed by said app. if there is just ONE svg being exported, it'll render that svg to the screen. if there is suddenly multiple exports as follows

export { ReactComponent as Alert } from "./alert.svg";
export { ReactComponent as Check } from "./check.svg";

and i STILL only import one...

import { SomeIcon } from "@company/test-lib";
import * as ReactDOM from "react-dom/client";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
  <div>
    <SomeIcon />
  </div>,
);

it hangs indefinitely. no errors. no crashes. no nothing. just keeps trying to load up. seriously wouldn't mind some advice on this its driving me insane.

EDIT: for some added context, in the browser network tab, i can see that it stays in a permanent pending state trying to fetch the svgs....

image

binaryartifex avatar Feb 29 '24 03:02 binaryartifex