{"action":"opened","issue":{"url":"https://api.github.com/repos/aurelia/cli/issues/157","labels_url":"https://api.github.com/repos/aurelia/cli/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/cli/issues/157/comments","events_url":"https://api.github.com/repos/aurelia/cli/issues/157/events","html_url":"https://github.com/aurelia/cli/issues/157","id":102141185,"number":157,"title":"Template bundling injected link doesn't respect baseURL","user":{"login":"SPARTAN563","id":1760260,"avatar_url":"https://avatars.githubusercontent.com/u/1760260?v=3","gravatar_id":"","url":"https://api.github.com/users/SPARTAN563","html_url":"https://github.com/SPARTAN563","followers_url":"https://api.github.com/users/SPARTAN563/followers","following_url":"https://api.github.com/users/SPARTAN563/following{/other_user}","gists_url":"https://api.github.com/users/SPARTAN563/gists{/gist_id}","starred_url":"https://api.github.com/users/SPARTAN563/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SPARTAN563/subscriptions","organizations_url":"https://api.github.com/users/SPARTAN563/orgs","repos_url":"https://api.github.com/users/SPARTAN563/repos","events_url":"https://api.github.com/users/SPARTAN563/events{/privacy}","received_events_url":"https://api.github.com/users/SPARTAN563/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-20T13:40:02Z","updated_at":"2015-08-20T13:40:02Z","closed_at":null,"body":"The injected `<link rel=\"import\" ...` used to include a template bundle is always forced to be relative in [src/lib/bundler/template-bundler.js](https://github.com/aurelia/cli/blob/master/src/lib/bundler/template-bundler.js#L67) - this results in an infinite recursion within the client's browser when visiting a page whose path results in a request for the bundle AND your server is configured to serve `index.html` for all unknown routes (common practice for applicatoins making use of the HTML5 History API.\r\n\r\nThis poses a problem in situations where you are making use of template bundling in combination with the HTML5 History API - and represents a deviation from the behaviour of JSPM under similar situations when `baseURL` is set in *config.js*.\r\n\r\nTo reproduce the error, use template bundling and the History API router mode while visiting <http://localhost:9000/test/test> - you should find that the site never finishes loading (and possibly hangs your web browser). Similarly, if you visit <http://localhost:9000/test> the site will load correctly and function without issues.\r\n\r\nThe issue is introduced in [src/lib/bundler/template-bundler.js](https://github.com/aurelia/cli/blob/master/src/lib/bundler/template-bundler.js#L67) as a result of the forced `./` prepending to the path of the bundle when injecting the link. Ideally this should default to `./` if `baseURL` is not specified in *config.js*, prepending the value of `baseURL` instead when it is available.\r\n\r\nPlease let me know if you need anything further from me to help expedite solving this problem, as it is giving us a bit of a headache at the moment and we are having to work around it using some (hacky) server configurations."}}