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

sourcemaps works incorrectly after any change in dev mode #997

Closed
cevek opened this issue Mar 13, 2018 · 9 comments
Closed

sourcemaps works incorrectly after any change in dev mode #997

cevek opened this issue Mar 13, 2018 · 9 comments
Labels

Comments

@cevek
Copy link

cevek commented Mar 13, 2018

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");
}

Run parcel index.html

After first build source maps works correctly
console output:

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

But after some changes in any of file sourcemaps turns into a mess:

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
@cevek cevek changed the title sourcemaps work incorrectly after any change in dev mode sourcemaps works incorrectly after any change in dev mode Mar 13, 2018
@DeMoorJasper
Copy link
Member

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

@cevek
Copy link
Author

cevek commented Mar 13, 2018

browser refresh

@cevek
Copy link
Author

cevek commented Mar 13, 2018

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"]}

@cevek
Copy link
Author

cevek commented Apr 11, 2018

any ETA?

@babakness
Copy link

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

@ghost
Copy link

ghost commented Jun 8, 2018

Same for me, very annoying.

@bitschaser
Copy link

bitschaser commented Jun 10, 2018

Same here. After first change source maps becomes useless.

@giyyapan
Copy link

Same for me. any update?

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Jul 18, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants