Reputation: 4393
I've got a .js
file similar to
import json from "$gameData/tags.json";
const func = () =>
{
// some function that uses the json variable
}
While debugging func
, at least WebStorm's debugger says that that json
is undefined, even though it clearly is present (when read by console.log, or interacted with in any other way).
Binding it to another variable makes it debuggable, such as:
import jsonImport from "$gameData/tags.json";
json = jsonImport;
Why does it appear undefined to the debugger? I've searched all throughout the stack as well.
Upvotes: 0
Views: 67
Reputation: 93888
It's a known issue when debugging ES6 modules transpiled by babel. Please see https://github.com/webpack/webpack/issues/3957, https://github.com/babel/babel/issues/1468 for details. You will face the same problem when debugging with Chrome DevTools, for example.
Upvotes: 1