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

File with the same name, chrome debugger breakpoint location is confused #10786

Open
liningftp opened this issue Dec 1, 2019 · 3 comments · May be fixed by #10797
Open

File with the same name, chrome debugger breakpoint location is confused #10786

liningftp opened this issue Dec 1, 2019 · 3 comments · May be fixed by #10797

Comments

@liningftp
Copy link

@liningftp liningftp commented Dec 1, 2019

Bug Report

Current Behavior
Open Chrome and Turn on F12
Visit http://127.0.0.1/index.html
Breakpoint occurs in ./2/a.js, line2

var b = 2;

But should occurs in ./a.js, line2

debugger

Input Code

./index.html

<!doctype html>
<html lang="en">
    <head>  
      <meta charset="utf-8">
      <title>test</title>
    </head>
    <body>
      <script src="https://unpkg.com/@babel/standalone@7.7.4/babel.min.js"></script>
      <script type="text/babel" src="./a.js"></script>
      <script type="text/babel" src="./2/a.js"></script>
      <script type="text/babel">
      	T();
      </script>
    </body>
</html>

./a.js

function T(){
	debugger;
}

./2/a.js

var a = 1;
var b = 2;
var c = 3;
var d = 4;

Expected behavior/code
Breakpoint occurs in ./a.js

Environment

  • Babel version(s): v7.7.4
  • Node/npm version: Node 13.0.1 /npm 6.12.0
  • OS: Windows 10
  • Browser: Chrome 78.0.3904.108 (64 bit)
  • Monorepo: [e.g. yes/no/Lerna]
  • How you are using Babel: loader
@babel-bot

This comment has been minimized.

Copy link
Collaborator

@babel-bot babel-bot commented Dec 1, 2019

Hey @liningftp! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@liningftp

This comment has been minimized.

Copy link
Author

@liningftp liningftp commented Dec 1, 2019

if ./a.js in the after ./2/a.js e.g.

      <script type="text/babel" src="./2/a.js"></script>
      <script type="text/babel" src="./a.js"></script>

debugger is right

@JLHwung

This comment has been minimized.

Copy link
Contributor

@JLHwung JLHwung commented Dec 2, 2019

@liningftp Good catch! What happens here is that babel-standalone generates incorrect source maps which confuses Chrome DevTools. It will be fixed in #10797.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.