Vite tries to read source map from vite-specific path
First raised in vite repo https://github.com/vitejs/vite/issues/4687, but I'm fairly sure it is caused by this plugin.
Describe the bug
While running vite in serve mode (but not build mode), the following error occurs for every component:
Sourcemap for "/redacted/app/src/components/global/AppBtn.vue" points to missing source files
vite:sourcemap Missing sources:
vite:sourcemap /redacted/app/src/components/global/AppBtn.vue?vue&type=style&index=0&scoped=true&lang.sass
Obviously trying to read a file at a path ending with a query is going to fail. Which is what vite seems to be doing. https://github.com/vitejs/vite/blob/8048f900908009757bd20d13ee4af90ce15cd32c/packages/vite/src/node/server/sourcemap.ts#L38-L39
The path without the query is correct though. I assume vite is supposed to intercept the URL and return the source map, but instead seems to use the URL as a path and load from the file system.
Just don't know why it would do this?
System Info
System:
OS: Linux 5.3 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
Memory: 6.56 GB / 15.41 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 14.17.5 - /usr/bin/node
Yarn: 1.22.11 - /usr/bin/yarn
npm: 6.14.14 - /usr/bin/npm
Browsers:
Chrome: 94.0.4603.0
npmPackages:
vite: ^2.4.4 => 2.4.4
Used Package Manager
npm
Can you share a minimal reproduction? Thanks.
Ok, have created a very simple one: https://github.com/shadow-light/test_vite_components_bug
Seems to be a clash with this plugin, enabling source maps during build, and adding additionalData for sass.
Did you solve that problem? That happened to me, too
Had to stop using additionalData for sass. I think this bug still needs fixing.
I didn't do anything but download the template and get an error
After a little trial and error, I discovered this issue was introduced after version 0.17.11. Downgrading to this version has fixed the issue for me!
Same error here. Downgrading to 0.17.11 fixes the issue.