{"action":"created","issue":{"url":"https://api.github.com/repos/jspm/jspm-cli/issues/853","labels_url":"https://api.github.com/repos/jspm/jspm-cli/issues/853/labels{/name}","comments_url":"https://api.github.com/repos/jspm/jspm-cli/issues/853/comments","events_url":"https://api.github.com/repos/jspm/jspm-cli/issues/853/events","html_url":"https://github.com/jspm/jspm-cli/issues/853","id":89139486,"number":853,"title":"Conflicting behavior for creating bundle with jspm and loading with systemjs","user":{"login":"ahmedshuhel","id":868075,"avatar_url":"https://avatars.githubusercontent.com/u/868075?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmedshuhel","html_url":"https://github.com/ahmedshuhel","followers_url":"https://api.github.com/users/ahmedshuhel/followers","following_url":"https://api.github.com/users/ahmedshuhel/following{/other_user}","gists_url":"https://api.github.com/users/ahmedshuhel/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmedshuhel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmedshuhel/subscriptions","organizations_url":"https://api.github.com/users/ahmedshuhel/orgs","repos_url":"https://api.github.com/users/ahmedshuhel/repos","events_url":"https://api.github.com/users/ahmedshuhel/events{/privacy}","received_events_url":"https://api.github.com/users/ahmedshuhel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jspm/jspm-cli/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-17T22:11:42Z","updated_at":"2015-06-24T21:46:54Z","closed_at":null,"body":"The conflicting behavior of `systemjs` and `jspm` bellow are causing problems:\r\n\r\n- When jspm creates bundle with `--inject` it creates relative to `baseURL` and does not consider the `paths`.\r\n- When systemjs loads an injected bundle, it loads relative to `paths`(if set) not baseURL. \r\n\r\nConsider the paths for [skeleton-navigation](http://github.com/aurelia/skeleton-navigation)` for example:\r\n```javascript\r\n  \"paths\": {\r\n    \"*\": \"dist/*.js\",\r\n    \"github:*\": \"jspm_packages/github/*.js\",\r\n    \"npm:*\": \"jspm_packages/npm/*.js\"\r\n  },\r\n```\r\nSo when we run `jspm bundle app dist/bundle.js -i` it creates a bundle in the `dist` folder but get's injected in the `config.js` like:\r\n\r\n```javascript\r\n  \"bundles\": {\r\n    \"dist/bundle\": [\r\n      \"npm:core-js@0.9.15/modules/$.fw\",\r\n      \"npm:core-js@0.9.15/modules/$.dom-create\",\r\n ```\r\n> Note that, it did not consider the `paths`.\r\n\r\nNow, when the application tries to load the bundle `systemjs` looks for an url like `dist/dist/bundle` as our `*` path is configured to `dist`. Thus fail to load.\r\n\r\nOn the other hand,\r\nIf we create a bundle with `jspm bundle app bundle.js -i`, this will create the bundle file in `baseURL` not in the `dist` folder, and application will look for the bundle with url like `dist/bundle.js` as the `*` path is set to `dist`. Again, the app will fail to load the bundle.\r\n\r\nbundle when injected is treated as a regular module as long as path resolution of `systemjs` is concern. So, it makes more sense if `jspm` considers `paths` along side `baseURL` when `inject` is set to true. \r\n\r\nI have resolved this issue in another project changing jspm api, I would like to participate and make a PR, if you allow me. Thank you."},"comment":{"url":"https://api.github.com/repos/jspm/jspm-cli/issues/comments/115021173","html_url":"https://github.com/jspm/jspm-cli/issues/853#issuecomment-115021173","issue_url":"https://api.github.com/repos/jspm/jspm-cli/issues/853","id":115021173,"user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars.githubusercontent.com/u/598730?v=3","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T21:46:54Z","updated_at":"2015-06-24T21:46:54Z","body":"A PR on this would be very welcome. The function to reverse-apply paths is provided at https://github.com/systemjs/builder/blob/master/lib/builder.js#L11 in SystemJS builder so should be possible to share here."}}