With this recipe, it's possible to take your application to the next level by using the subdirectories for router modules and environments for router control.
With those increments, the function may be extracted to another file, but in router.js, it still needs to be imported into the main.js file. Or, you can obtain the import function, and pass the array of routes to router.js.