Can anybody explain to me the following scenario in a react-js context: I work with webpack and use the presets "babel-preset-env" & "react".
On top of a file I import a config.json which I try to inspect with the developer tools and a debugger-statement.
The console.log logs an array of objects as expected. If I enter the developer-tools js-console and enter CONFIG I get an Uncaught ReferenceError: CONFIG is not defined.
import React, { Component } from 'react';
import CONFIG from './config.json';
class MyComponent extends Component{
render(){
//this statement logs as expected
console.log(CONFIG);
// the debugger stops execution, but when I enter CONFIG in the
// dev-tools Console I get the error: Uncaught ReferenceError:
// CONFIG is not defined
debugger;
}
}
Any help is much appreciated.