Aurelia configuration import fails when changing route

Hi!

Can anyone tell me why it’s trying to import the aurelia configuration from http://localhost:9000/login/config/config.json instead of http://localhost:9000/config/config.json ? Note the /login, which is a route on my router.

When I use config.setDirectory('/config'); to set the root of the Aurelia Plugin It works for the Aurelia Configuration plugin. But then is will give the same issue with other NPM packages.

Appreciate any help!

1 Like

Without any code, I wouls guess your config url is missing a leading slash

@bigopon. Thank you for your reply. Appreciate it!

Don’t know if you saw my edit. But when I add config.setDirectory('/config') for the Aurela Configuration plugin it solves it for the config issue. This is way I make sure it look into the root. In my main.ts

    const config = aurelia.container.get(AureliaConfiguration);
    config.setDirectory('/config');
    await config.loadConfig();

But the same issue happens when I open a route. That why I don’t think the setDirectory is not the main solution.

{ 
	route: ['', ':workspace/', ':workspace/overview'], 
	name: 'overview', 
	moduleId: PLATFORM.moduleName('views/overview/overview'), 
	title: '', 
}

The first part of the route should be a workspace slug, which can change obviously. But when hitting this route with the workspace slug, in this case de-boer, all of the sudden it can’t find my UX package anymore. It adds the workspace slug to that import as well, and that way it can’t find it anymore.

Note that the UX package import works nomally when I hit the / route.

import '@my-project-name/ux';

Also, the workspace slug is found in my activate on the overview page.

public activate(params: any): void {
	console.log('overview', params);
}