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

[Help] Issue pulling in svgr types.

Open mikeymop opened this issue 1 year ago • 1 comments

I recently updated to module version 2.2.1 and noticed that I now have a hard-to-figure-out error in my tsconfig.json in relation to this plugin.

Interestingly, this is fine in my vite.config.ts. Is it expected to include tsconfig.json in it's own includes?

tsconfig.json

Cannot find type definition file for 'vite-plugin-svgr/client'.
  The file is in the program because:
    Entry point of type library 'vite-plugin-svgr/client' specified in compilerOptions

at

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["dom", "dom.iterable", "esnext"],
    "types": ["vite/client", "@types/vite-plugin-svgr/client", "@types/react", "jest"],
    ...
    }
  "files": [ // is it expected to include tsconfig.json here?
    "vite.config.ts",
    "public/source-env.js",
  ],
  "include": [
    "src",
    "env/*.js",
    "src/**/*.test.ts",
  ]
}

package.json

"devDependencies": {
    "vite-plugin-svgr": "^2.2.1",
    ...
}

mikeymop avatar Sep 21 '22 21:09 mikeymop

@mikeymop Is this resolved? Seems like changing @types/vite-plugin-svgr/client -> vite-plugin-svgr/client in compilerOptions.types might help.

sni-J avatar Nov 30 '22 02:11 sni-J