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

Created on 22 Mar 2020  路  3Comments  路  Source: JetBrains/svg-sprite-loader

Screen Shot 2563-03-22 at 13 08 24

* environment:*

  • Node.js version: v12.12.0
  • webpack version: 4.36.1
  • svg-sprite-loader version: 4.2.1
  • OS type & version: 10.12.6
    "next-optimized-images": "^2.5.5",

All 3 comments

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.

Thanks, I have fixed it.

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
...
Was this page helpful?
0 / 5 - 0 ratings

Related issues

edaena picture edaena  路  7Comments

no-more picture no-more  路  7Comments

Bosch-Eli-Black picture Bosch-Eli-Black  路  6Comments

Emiliano-Bucci picture Emiliano-Bucci  路  6Comments

suamikim picture suamikim  路  5Comments