Skip to content

Vite doesn't inline SVG assets #1197

@andylizi

Description

@andylizi

if (!id.endsWith(`.svg`) && content.length < Number(inlineLimit)) {
url = `data:${mime.lookup(id)};base64,${content.toString('base64')}`
content = undefined
}

Hi. I noticed that svg files is explicitly excluded in the assetsInlineLimit feature, and I'm wondering why that is so. Renaming the extension to .SVG (thus bypassing the .endsWith check) works fine in my project.

This limit exists since the first time the feature was added, and I'm unable to find any kind of comments or documentation about it. Could someone shed some light on this please? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions