Debugging in Chrome and FireFox not evaluating "let" and "const" vars
See original GitHub issueIs 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
node -v
: 8.7.0npm -v
: 5.4.2yarn --version
(if you use Yarn):npm ls react-scripts
(if you haven’t ejected): 1.0.14
Then, specify:
- Operating system: Windows 10
- 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:
- Write a module that uses ES6 const and let keys words inside a switch statement. For me, it’s in a redux reducer
- npm run start
- Debug the module, see something similar to below:
Expected Behavior
Variables to evaluate properly
Actual Behavior
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:
- Created 6 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
I tried with various devtool settings, and nothing seemed to fix it. Also noticed in FireFox.