I'm trying to require a js file in cypress and it works with a static string but as soon as I try string templates, it no longer finds the file.
const page = require('../../cypress/model/page/web/app/Homepage.js');
//const page = require(`../../cypress/model/page/web/app/${pageName}.js`);
As @ pavelsaman already commented, you should first check what is in pagename. simply a console.log(pagename). Maybe you can find the error here.
If pagename looks good you can try with concatination:
pageName = 'somePage' + '.js';
const page = require('../../cypress/model/page/web/app/' + pageName);