Skip to content
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

[Bug Report] Vue SFC source map is missing when there is no script block #8601

Closed
7 tasks done
meteorlxy opened this issue Jun 15, 2022 · 0 comments · Fixed by #8604
Closed
7 tasks done

[Bug Report] Vue SFC source map is missing when there is no script block #8601

meteorlxy opened this issue Jun 15, 2022 · 0 comments · Fixed by #8604
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@meteorlxy
Copy link
Contributor

meteorlxy commented Jun 15, 2022

Describe the bug

Create a vue SFC without script block NoSourceMap.vue:

<template>
  <p>The sourcemap if NoSourceMap.vue is missing</p>
</template>

Check the devtools, you'll find that it does not have sourcemap at the end of the transformed file:

image

Compared with a SFC with non-empty script block:

image


Suspicious Code

// if the template is inlined into the main module (indicated by the presence
// of templateMap, we need to concatenate the two source maps.
let resolvedMap = options.sourceMap ? map : undefined
if (resolvedMap && templateMap) {

Currently we require both scriptMap (aka map or resolvedMap in above code) and templateMap existing to concat templateMap with scriptMap. If scriptMap is empty, then templateMap will not be used at all.

Related Issue

#2959 is similar with this one, but it was reporting the missing of sourcemap in prod. These two issues are related, and potentially to have a same / similar root cause, but I think they are different.

Reproduction

https://stackblitz.com/edit/vitejs-vite-mseree?file=src/NoSourceMap.vue

System Info

Not related

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) plugin: vue and removed pending triage labels Jun 15, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants