Skip to content

Failed to resolve the relative background image url in css when there're (/) in it's parent paths. #19261

@sapphi-red

Description

@sapphi-red

Describe the bug

It seems to fail to resolve the relative background image url in css when a component is located in a folder containing brackets.

A workaround is to wrap the url with double quotes:

.foo {
  background: url(./javascript.svg); /* before */
  background: url("./javascript.svg"); /* after */
}

This works in build.

Migrated from vitejs/vite-plugin-vue#512

Reproduction

https://stackblitz.com/edit/vitejs-vite-hebxocad?file=src%2Fmain.js,src%2F(foo)%2Findex.css,vite.config.js&terminal=dev

Steps to reproduce

No response

System Info

Stackblitz

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^6.0.7 => 6.0.10

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions