I meet a weird problem. If I set a variable direclty with a value like this "const myString = 'someWord';" that work but if I take the value from a variable like this "const myString = someVariable;", that doesn't work, and if I set the value on a conditional block that doesn't work too.
So, work:
var jsonName = 'tramwayen'; const pathex = require('../assets/JSON/' + jsonName); var json = JSON.parse(JSON.stringify(pathex)); doesn't work:
var jsonName = variable; const pathex = require('../assets/JSON/' + jsonName); var json = JSON.parse(JSON.stringify(pathex)); doesn't work:
var jsonName = ''; if (condition) { jsonName = 'tramwayen'; } const pathex = require('../assets/JSON/' + jsonName); var json = JSON.parse(JSON.stringify(pathex)); I really don't understand.
I have this error : "Invalid call at line 41: require('../assets/JSON/' + jsonName2)"