New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misleading warning and incorrect sourcemap behavior #4423
Comments
If you do These are the missing sources according to Vite:
It looks like SvelteKit is generating broken sourcemaps, where the
That's only for virtual modules (ie: a generated module without a 1-to-1 file association).
Vite needs to inject source code into the |
Aha! Thanks! I had been trying to figure out how to do this with various incantations like I appreciate the explanation! I'll sync up with the Svelte folks and see if we can get it fixed there |
You can always try Here's the full undocumented list found by searching for
|
Describe the bug
This bug was introduced in #2904
Here's the warning I get:
Here are the sourcemap definitions:
Those files definitely exist
It's strange that Vite is even trying to read the source maps upon starting my app. They shouldn't be required unless an exception is thrown
Anyway, those files do exist. I see that #2904 says the path must be absolute. I strongly disagree with that and think that's the wrong behavior. If I build on my local machine or CI and then deploy the app to a production machine then the path I deploy to in production likely won't be the path where I built the app. That makes absolute paths broken. I reviewed some PRs for Svelte source map support and remember this question coming up there. When I'd looked at what was generally being done, I saw the majority of libraries use relative paths, which was what we had decided on as well. Rollup and other build tools are perfectly happy with relative paths
Even if Vite were going to keep this behavior the warning message is quite misleading. The files do exist. As far as I can tell, Vite simply isn't looking for them and a better warning would be about the paths being relative vs absolute. It'd also have been helpful for the warning message to include the location being pointed to. It was a little tricky to trackdown because these are virtual files, so I had to hack the source code to print out the source map since it didn't exist anywhere on disk
All that being said, I'm extremely grateful for #2904 because the previous behavior of throwing an exception instead of logging a warning was much worse 😄
Reproduction
This happens on newly created SvelteKit projects
npm init svelte@next my-app
- choose Skeleton app and defaults for all othersSystem Info
npx envinfo --npmPackages @sveltejs/kit,vite,@vitejs/plugin-vue npmPackages: @sveltejs/kit: next => 1.0.0-next.138
Vite version is 2.4.4
Validations
The text was updated successfully, but these errors were encountered: