When I pass a string to file-loader require method in computed property it works fine, like this
computedProp () {
return require('../path/to/file');
}
but if I try to pass some variable into it it throws error
computedProp () {
const l = '../path/to/file';
return require(l);
}
Error: Error: Cannot find module "."
How can I fix that? I want to create the relative path based on some condition and then want to pass it to require method to get an absolute path.