I have an autogenerated fairly large js file that its content is just one big variable like this:
ConstDef.js:
var ConstantDefinitions = {
variable1: "blahbalhbalh",
variable2: "blahBlahBlah",
...
variable10000: "BlahbluuBleh"
}
How can I access the contents of this file in React.js?
If I add export {ConstantDefinitions} manually at the bottom of ConstDef.js, I can easily write something like:
import { ConstantDefinitions } from './ConstDef';
const defHelper = {
getStringByKey(key) {
const def = ConstantDefinitions [key];
return def;
}
};
export default defHelper ;
My plan B is to write a script to somehow append export {ConstantDefinitions} to my autogenerated file, However, I am trying to access that object without manipulating the source.