var route = '.' + route.path + '-view.js';
require(route);
But it doesn’t work. This is working.
require('./search-view.js');
So for some reason it’s not working with variables. Is this a meteor issue or a require issue? I’ve tried various solutions found on the internet and a few of my own without any success.
@AndreasGalster I assume that you are running require during run-time [inside a callback function] since you are using route path. Its different when you add import to a callback instead of adding directly to a file which runs. It loses context. Here you have to give full path to the file from root. For eg {a} = require(’/imports/ui/views/search-view.js’) .