parcel
parcel copied to clipboard
Invalid sourcemaps with template literal
After some heavy debugging I figured out. If you are using Template literals (``) the source map is completely broken.
index.ts
console.log("test1") // line 1 correct
let text = `
1
1
1
1
1
1
`
console.log("test2") // this should be line 12, instead 17 in devtools
let test0
let test1
console.log("test3") // this only woks because last line if you add more content it wont work
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script src="./index.ts"></script>
</body>
</html>
Devtools
Originally posted by @Levminer in https://github.com/parcel-bundler/parcel/issues/5815#issuecomment-1181540189
As a workaround setting line endings LF in vs code fixes this, thanks for the help!
Thanks, God, I found this issue! 😀 Was struggling with weird debugging issues and totally wrong source maps... Changing CRLF to LF line endings is a workaround, but this should really be fixed.