Ionic2 RC0 - Error: Uncaught (in promise): Failed to load home.page.html

I updated my app from beta11 to rc0 and, among other issues, I have load errors in all my html pages, like the one in the post title.

After some time (more than I expected :disappointed_relieved:) trying to find out the cause, I figured out that this was happening because I use constants in the @Component fields of my component classes. Something like (not exactly like in my code, but reproduce the same issue):

const MY_INFO = {
	SELECTOR: 'my-home-page',
	TEMPLATE_URL: 'home.page.html'
};

@Component({
	selector: MY_INFO.SELECTOR,
	templateUrl: MY_INFO.TEMPLATE_URL,
})
export class HomePage {}

After I changed it to:

@Component({
	selector: 'my-home-page',
	templateUrl: 'home.page.html'
})
export class HomePage {}

it worked.


This is probably related with AoT Compilation. I think the compilation ignores the constant values for the annotation metadata or something like that.

Is there a simple way to make it work? For now, I’ve changed all my components to use the explicit name and selector strings.

Thanks in advance.