Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
binaryartifex opened this issue Feb 29, 2024 · 1 comment

Comments

@binaryartifex
Copy link

binaryartifex commented Feb 29, 2024

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

@amcdnl
Copy link

amcdnl commented Mar 4, 2024

Using your config, I also get the same thing on the 3rd import of an image.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants