I'm trying to configure routes in Aurelia using aurelia-router, but it throws an error that it can't find the moduleId(route to file) of my route.
I configure my routes in two files router.js and app.js, router file only contains an array with all the routes. app file is the main file of my project.
export default [
{ route: ['', '/', 'home'], name: 'home', title: 'Inicio', layoutView: 'components/common/layout/layout.html', moduleId: 'components/home/home' }
]
import routes from 'router'
import {RouterConfiguration, Router} from 'aurelia-router';
export class App {
configureRouter(config, router){
config.options.root = '/';
config.title = 'La Tatuadora';
this.router = router;
config.map(routes);
}
}
Aurelia provides PLATFORM.moduleName("moduleId")
to resolve modules, it comes with the aurelia-pal
package.
In use it looks like this:
{ moduleId: PLATFORM.moduleName("components/home/home") }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With