Parcel: sourcemaps works incorrectly after any change in dev mode

Created on 13 Mar 2018  路  9Comments  路  Source: parcel-bundler/parcel

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="./index.js"></script>
</body>
</html>
//index.js
import { foo } from "./foo";

console.log("index");
foo();
//foo.js
export function foo() {
  console.log("foo");
}



md5-96771a622158ff2aae0ecea220161740



index         index.js:3
foo           foo.js:2



md5-942f3276fd7261742a21452d5c5ac6c0



index         index.js:3
foo           parcel-sourcemap.js:82

Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.6.2
| Node | 9.2.1
| npm/Yarn | 5.5.1
| Operating System | osx

Bug

Most helpful comment

I've looked into it and it is a pretty straightforward bug, I've fixed it and opened up a PR

All 9 comments

Is this after a hot reload or a complete browser refresh? As in the first case it would make sense

browser refresh

I've compared source maps before and after change, parcel adds some construct that breaks aligning
;;;;;;;ACAA;;AAEAC,QAAQC,GAAR,CAAY,OAAZ;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

{"version":3,"sources":["foo.js","index.js"],"names":["foo","console","log"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AAEAC,QAAQC,GAAR,CAAY,OAAZ;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QDHgBF,MAAAA;AAAT,SAASA,GAAT,GAAe;AACpBC,UAAQC,GAAR,CAAY,KAAZ;AACD","file":"parcel-sourcemap.map","sourcesContent":["export function foo() {\n  console.log(\"foo\");\n}\n","import { foo } from \"./foo\";\n\nconsole.log(\"index\");\nfoo();\n"]}
{"version":3,"sources":["foo.js","index.js"],"names":["foo","console","log"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAgBA,MAAAA;AAAT,SAASA,GAAT,GAAe;AACpBC,UAAQC,GAAR,CAAY,KAAZ;AACD;;;;ACFD;;AAEAD,QAAQC,GAAR,CAAY,OAAZ;AACA","file":"parcel-sourcemap.map","sourcesContent":["export function foo() {\n  console.log(\"foo\");\n}\n","import { foo } from \"./foo\";\n\nconsole.log(\"index\");\nfoo();\n\n"]}

any ETA?

Confirming bug, after a few saves, you have to restart the server for sourcemaps to work correctly

Same for me, very annoying.

Same here. After first change source maps becomes useless.

Same for me. any update?

I've looked into it and it is a pretty straightforward bug, I've fixed it and opened up a PR

Was this page helpful?
0 / 5 - 0 ratings