JetBrains / svg-sprite-loader

Webpack loader for creating SVG sprites.
MIT License
2.02k stars 272 forks source link

svg-sprite-loader #undefined with next-images || next-optimized-images #386

Open hongkongk opened 4 years ago

hongkongk commented 4 years ago
Screen Shot 2563-03-22 at 13 08 24

environment:

kisenka commented 4 years ago

Could you please create repo with minimal setup to demonstrate a problem (package.json, webpack config, SVG image and piece of your code). If you don't want to create a repository - you can create a gist with multiple files.

hongkongk commented 4 years ago

Thanks, I have fixed it.

denizkoele commented 4 years ago

Overwriting our global typing in TypeScript to make svg imports work with react-inline-svg.

Workaround is to use path mapping to redirect next-images typing to a custom file.

tsconfig.json

{
  "compilerOptions": {
    ...
    "paths: { 
      "next-images": ["./local_types/whatever.d.ts"]
    }
  }
}

./local_types/whatever.d.ts

// type for react-inline-svg
declare module '*.svg' {
  const content: any;
  export default content;
}

// copy rest of types
...