0

I am building the custom NPM package based on React, typescript, svg's...

For bundling the package there is Rollup.

The problem is cus I have imported svg's as React components.

There is a bunch of similar solutions for this that says, to add a custom.d.ts file and some custom module logic there:

custom.d.ts

declare module '*.svg';

When I include custom.d.ts there is no error, but I am worried about this solution, is this kind of solution good in the long term?

I want to be sure this is a good solution, and if is not, to find a proper solution for this.

Error:

[!] (plugin rpt2) Error: /Users/nikolatrajkovic/Desktop/enrollment-client/src/components/StatusTemplate/StatusTemplate.tsx(3,23): semantic error TS2307: Cannot find module '../../icons/link-caret-right-unstyled.svg' or its corresponding type declarations.

Mark James
  • 781
  • 3
  • 9
  • 26
  • 1
    Does this answer your question? [Unable to import svg files in typescript](https://stackoverflow.com/questions/44717164/unable-to-import-svg-files-in-typescript) – Stanislas Dec 17 '21 at 19:53

0 Answers0