Describe the bug
Following on from my comment in #7651 - the linked PR (#10741) doesn't solve the issue when main.js and assets are stored in a top level assets directory, e.g.:
├── assets
│ ├── images
│ │ └── vite.svg
│ ├── main.js
│ └── styles
│ ├── pages
│ │ └── home.scss
│ └── style.scss
├── index.html
├── package.json
├── package-lock.json
├── public
│ └── vite.svg
└── README.md
You can see in the linked reproducer that url('../../images/vite.svg') does not resolve the image correctly, even though that is the correct relative path to the file from assets/styles/pages/home.scss. When the path is changed to url('../images/vite.svg') it resolves correctly.
Reproduction
https://github.com/andyexeter/vitejs-vite-2btrkm
Steps to reproduce
Run npm install followed by npm run dev
System Info
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11600 @ 2.80GHz
Memory: 6.97 GB / 15.47 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.18.1 - /usr/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 8.19.2 - /usr/bin/npm
Browsers:
Chrome: 107.0.5304.110
Firefox: 107.0
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
Following on from my comment in #7651 - the linked PR (#10741) doesn't solve the issue when main.js and assets are stored in a top level assets directory, e.g.:
You can see in the linked reproducer that
url('../../images/vite.svg')does not resolve the image correctly, even though that is the correct relative path to the file fromassets/styles/pages/home.scss. When the path is changed tourl('../images/vite.svg')it resolves correctly.Reproduction
https://github.com/andyexeter/vitejs-vite-2btrkm
Steps to reproduce
Run
npm installfollowed bynpm run devSystem Info
System: OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa) CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11600 @ 2.80GHz Memory: 6.97 GB / 15.47 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 16.18.1 - /usr/bin/node Yarn: 1.22.17 - /usr/bin/yarn npm: 8.19.2 - /usr/bin/npm Browsers: Chrome: 107.0.5304.110 Firefox: 107.0Used Package Manager
npm
Logs
No response
Validations