Skip to content

srcset attribute of img is compiled to requrie(xxx) in vite build  #83

Open
@daolanfler

Description

@daolanfler

I was migrating a vue2/vue-cli project to vite. In the production build, I found this requrie is not defined error in devtools console.
image

I find that srcset is handled in @vue/compiler-sfc 's this file it transforms srcset="" to require("") , causing the above error. I don't think that's an expected behaviour.

Also in dev mode, using vite-inspect I found there was no such transform

image

Reproduction link

minimum reproduction link

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