I am trying to loop over array of strings and require them with require and for some reason this is not working.
This is working:
console.log(require('./siteParts/testis')); This is not:
var siteParts = ['testis']; siteParts.forEach(function(part) { console.log(require('./siteParts/' + part)); Error: Cannot find module './siteParts/testis' });