Skip to content

[next-image-loader] "TypeError: Invalid SVG" when importing SVG sprites #26176

@gdorsi

Description

@gdorsi

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

v14.15.1

What browser are you using?

What operating system are you using?

macOS

How are you deploying your application?

Other platform

Describe the Bug

When a svg sprite (like this one) is imported "TypeError: Invalid SVG" is thrown on build.

Expected Behavior

The import should return the StaticImageData with an empty placeholder without throwing an error.

To Reproduce

  1. Start a new next project
  2. Download this image
  3. Import the svg in a javascript module (import logo from "./logo-header.svg")
  4. Run the build with next build

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions