Skip to content

Asset imports from Vue's SFCs are mangled #14212

@ferferga

Description

@ferferga

Astro Info

Astro                    v5.12.9
Node                     v20.19.1
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/vue

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When static assets are imported in Vue's SFC components, they are processed by Astro instead of Vite's normal static asset handling.

To reproduce the bug from the reproduction:

  1. Open the stackblitz link
  2. Navigate to /app
  3. See that the image element of App.vue is something along the lines of (both dev and production):
<img src="(...args) => {
    if (!validateArgs(args)) {
      throw new AstroError({
        ...AstroErrorData.InvalidComponentArgs,
        message: AstroErrorData.InvalidComponentArgs.message(name)
      });
    }
    return cb(...args);
  }">

What's the expected result?

The build pipeline from all the module graph that comes from .vue files must be kept intact and my component works as it would normally do when bundled using a standalone Vite project.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-ewhqmw3l

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions