The beta release of Angular (since vesion 2-alpha.51) supports relative assets for components, like templateUrl and styleUrls in the @Component
decorator.
module.id
works when using CommonJS. You don’t need to worry about how it works.
Remember: setting moduleId: module.id in the @Component decorator is
the key here. If you don’t have that then Angular 2 will be looking
for your files at the root level.
Source from Justin Schwartzenberger’s post, thanks to @Pradeep Jain
Update on 16 Sep 2016:
If you are using webpack for bundling then you don’t need
module.id
in decorator. Webpack plugins auto handle (add it)
module.id
in final bundle