{"action":"created","issue":{"url":"https://api.github.com/repos/jtblin/angular-chart.js/issues/147","labels_url":"https://api.github.com/repos/jtblin/angular-chart.js/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/jtblin/angular-chart.js/issues/147/comments","events_url":"https://api.github.com/repos/jtblin/angular-chart.js/issues/147/events","html_url":"https://github.com/jtblin/angular-chart.js/issues/147","id":94324018,"number":147,"title":"RequireJS and chart.js module name","user":{"login":"potatopeelings","id":300494,"avatar_url":"https://avatars.githubusercontent.com/u/300494?v=3","gravatar_id":"","url":"https://api.github.com/users/potatopeelings","html_url":"https://github.com/potatopeelings","followers_url":"https://api.github.com/users/potatopeelings/followers","following_url":"https://api.github.com/users/potatopeelings/following{/other_user}","gists_url":"https://api.github.com/users/potatopeelings/gists{/gist_id}","starred_url":"https://api.github.com/users/potatopeelings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/potatopeelings/subscriptions","organizations_url":"https://api.github.com/users/potatopeelings/orgs","repos_url":"https://api.github.com/users/potatopeelings/repos","events_url":"https://api.github.com/users/potatopeelings/events{/privacy}","received_events_url":"https://api.github.com/users/potatopeelings/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-10T15:01:11Z","updated_at":"2015-07-15T06:06:14Z","closed_at":null,"body":"With the current AMD module ID of `chart.js`, RequireJS will not use any paths configured in requirejs.config. It will instead attempt to load chart.js from &lt;root&gt;/chart.js (where root is where the HTML page which calls RequireJS is located)\r\n\r\nHere is the folder structure to replicate the problem\r\n\r\n    index.html\r\n    main.js\r\n    app.js\r\n    lib/\r\n        chart.js\r\n        angular-chart.js\r\n        angular.js\r\n        require.js\r\n\r\n##### index.html\r\n    <script data-main=\"main\" src=\"lib/require.js\"></script>\r\n\r\n##### main.js \r\n    require.config({\r\n        paths: {\r\n            'angular': 'lib/angular',\r\n            'angular-chart': 'lib/angular-chart',\r\n            'chart.js': 'lib/Chart',\r\n        },\r\n        deps: ['app']\r\n    });\r\n\r\n##### app.js\r\n     define(['angular-chart'], function (angularChart) {\r\n     });\r\n\r\nRequireJS will attempt to load the chart.js AMD module from ./chart.js instead of ./lib/chart.js. This is because of \r\n\r\n> If a module ID has one of the following characteristics, the ID will not be passed through the \"baseUrl + paths\" configuration, and just be treated like a regular URL that is relative to the document:\r\n>    • Ends in \".js\".\r\n>    • Starts with a \"/\".\r\n>    • Contains an URL protocol, like \"http:\" or \"https:\".\r\n\r\nSee http://requirejs.org/docs/api.html#jsfiles. \r\n\r\nThe fix would be change the Require.JS module ID of chart.js to something that doesn't end in chart.js and doesn't fall in any of the 3 buckets above.\r\n\r\nThis seems to be similar to https://github.com/twitter/typeahead.js/issues/1211.\r\n\r\nAlso related - this SO question http://stackoverflow.com/questions/31288001 (there's a workaround in this, but I think it's a bit hacky)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jtblin/angular-chart.js/issues/comments/121501344","html_url":"https://github.com/jtblin/angular-chart.js/issues/147#issuecomment-121501344","issue_url":"https://api.github.com/repos/jtblin/angular-chart.js/issues/147","id":121501344,"user":{"login":"vaneshmali","id":13268952,"avatar_url":"https://avatars.githubusercontent.com/u/13268952?v=3","gravatar_id":"","url":"https://api.github.com/users/vaneshmali","html_url":"https://github.com/vaneshmali","followers_url":"https://api.github.com/users/vaneshmali/followers","following_url":"https://api.github.com/users/vaneshmali/following{/other_user}","gists_url":"https://api.github.com/users/vaneshmali/gists{/gist_id}","starred_url":"https://api.github.com/users/vaneshmali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaneshmali/subscriptions","organizations_url":"https://api.github.com/users/vaneshmali/orgs","repos_url":"https://api.github.com/users/vaneshmali/repos","events_url":"https://api.github.com/users/vaneshmali/events{/privacy}","received_events_url":"https://api.github.com/users/vaneshmali/received_events","type":"User","site_admin":false},"created_at":"2015-07-15T06:06:14Z","updated_at":"2015-07-15T06:06:14Z","body":"There should be a standard and easy way to FIX it. Hope it will...!!! Waiting for the same."}}