question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vite tries to read source map from vite-specific path

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
danielwaltzcommented, Jan 25, 2022

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!

0reactions
enodrcommented, Feb 11, 2022

Same error here. Downgrading to 0.17.11 fixes the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugin API
Virtual modules are a useful scheme that allows you to pass build time information to the source files using normal ESM import syntax....
Read more >
A deep-dive on Vite featuring Evan You (JS Party #212)
... route, but we sort of pre-bundle them. So this is where Vite tries to be smart, as it separates your source code...
Read more >
vite
30, import { SourceMap } from 'rollup';. 31, import * as stream from 'stream';. 32, import { TransformOptions as TransformOptions_2 } from 'esbuild';....
Read more >
cannot find module 'vite' or its corresponding type ...
Another thing you could try is importing Kaki with a relative path (so without the ~ alias)? The ~ alias may be broken...
Read more >
454: All About Vite with Evan You
32:14 What is the future of Babel? 37:53 Source maps; 43:00 Sponsor: Deque's axe DevTools; 44:49 Writing your config files; 50:24 First 2 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found