question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging in Chrome and FireFox not evaluating "let" and "const" vars

See original GitHub issue

Is this a bug report?

Yes, though not entirely sure it’s CRA related, may be babel or webpack.

Can you also reproduce the problem with npm 4.x?

I don’t think it’s relevant, but will try if requested.

Which terms did you search for in User Guide?

DevTools, Chrome, ES6, Source Maps, lots of other googling beyond

Environment

  1. node -v: 8.7.0
  2. npm -v: 5.4.2
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): 1.0.14

Then, specify:

  1. Operating system: Windows 10
  2. Browser and version (if relevant): Chrome Chrome 62.0.3202.94, FireFox 57.0.1

Steps to Reproduce

As far as I can tell, it’s a simple as:

  1. Write a module that uses ES6 const and let keys words inside a switch statement. For me, it’s in a redux reducer
  2. npm run start
  3. Debug the module, see something similar to below:

Expected Behavior

Variables to evaluate properly

Actual Behavior

image

state is defined, newState should be defined, but is not. I’m wondering if this is because I use similar naming in each switch case block.

I’ve also removed all Flow typing from the file, same result. I’ve also tried several devtool options for Webpack with no changes.

Reproducible Demo

https://github.com/facebookincubator/create-react-app/issues/3597#issuecomment-356338424

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TheTFocommented, Jan 9, 2018

Sorry, Dan. I got caught up with the holidays, and this fell off.

I can’t share my code, but I’ll try to put together a reproduction tomorrow.

On Mon, Jan 8, 2018, 7:08 PM Dan Abramov notifications@github.com wrote:

This will need some investigation. I don’t know if there’s a way to fix it with Babel/Webpack but it’s worth looking into. Unfortunately I won’t have time to do it myself.

cc @samccone https://github.com/samccone @paulirish https://github.com/paulirish Can somebody on your side help us figure out why this broke? I think it used to work although I might be wrong.

@TheTFo https://github.com/thetfo @d07RiV https://github.com/d07riv Please prepare a reproducing example, it’s very hard to help you if you didn’t create one. This issue could’ve progressed if you spent a few minutes sharing it.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/facebookincubator/create-react-app/issues/3597#issuecomment-356137229, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgWoF9n4zE7tmfjZKGX7Vci0QzHNOK9ks5tIq4AgaJpZM4RBfiE .

1reaction
TheTFocommented, Dec 14, 2017

I tried with various devtool settings, and nothing seemed to fix it. Also noticed in FireFox.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are my variables undefined when using `Debugger` in ...
Ran into this frustrating scenario today while trying to debug my Redux store: console.log(reducer) debugger; const store = createStore( reducer,
Read more >
Why does Chrome debugger think closed local variable is ...
It will allocate local variables on the stack so long as the function does not contain any inner function that refers to them....
Read more >
Declare with let in Chrome bug - The freeCodeCamp Forum
Hi,. I think I have found a bug in Chrome. let does not let you re-declare variable however you can do in Chrome....
Read more >
ES6 In Depth: let and const - the Web developer blog
It has to do with variables. Problem #1: Blocks are not scopes. The rule sounds so innocent: The scope of a var declared...
Read more >
Handling common JavaScript problems - MDN Web Docs
Note: The easiest solution is to declare the iteration variable with let instead of var —the value of i associated with the function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found