{"action":"opened","issue":{"url":"https://api.github.com/repos/jspm/jspm-cli/issues/1025","labels_url":"https://api.github.com/repos/jspm/jspm-cli/issues/1025/labels{/name}","comments_url":"https://api.github.com/repos/jspm/jspm-cli/issues/1025/comments","events_url":"https://api.github.com/repos/jspm/jspm-cli/issues/1025/events","html_url":"https://github.com/jspm/jspm-cli/issues/1025","id":101516059,"number":1025,"title":"Typescript as a bundled package behaves strange","user":{"login":"shlomiassaf","id":5377501,"avatar_url":"https://avatars.githubusercontent.com/u/5377501?v=3","gravatar_id":"","url":"https://api.github.com/users/shlomiassaf","html_url":"https://github.com/shlomiassaf","followers_url":"https://api.github.com/users/shlomiassaf/followers","following_url":"https://api.github.com/users/shlomiassaf/following{/other_user}","gists_url":"https://api.github.com/users/shlomiassaf/gists{/gist_id}","starred_url":"https://api.github.com/users/shlomiassaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shlomiassaf/subscriptions","organizations_url":"https://api.github.com/users/shlomiassaf/orgs","repos_url":"https://api.github.com/users/shlomiassaf/repos","events_url":"https://api.github.com/users/shlomiassaf/events{/privacy}","received_events_url":"https://api.github.com/users/shlomiassaf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-17T21:41:52Z","updated_at":"2015-08-17T21:41:52Z","closed_at":null,"body":"Using `config.js` without bundling works great for typescript files.\r\n\r\nWhen bundling, strange things happen. Narrowed it to 'typescript' package.\r\n\r\nIf I bundle typescript only  (`jspm bundle typescript`) and load it like this:\r\n```\r\n<script src=\"/jspm_packages/system.src.js\"></script>\r\n<script src=\"config.js\"></script>\r\n<script src=\"/build.js\"></script>\r\n```\r\n\r\nThis is the output of the bundle cli command: \r\n```\r\n$ jspm bundle typescript\r\n     Building the bundle tree for typescript...\r\n\r\n       github:jspm/nodelibs-fs@0.1.2.js\r\n       github:jspm/nodelibs-fs@0.1.2/index.js\r\n       github:jspm/nodelibs-os@0.1.0.js\r\n       github:jspm/nodelibs-os@0.1.0/index.js\r\n       github:jspm/nodelibs-path@0.1.0.js\r\n       github:jspm/nodelibs-path@0.1.0/index.js\r\n       github:jspm/nodelibs-process@0.1.1.js\r\n       github:jspm/nodelibs-process@0.1.1/index.js\r\n       npm:os-browserify@0.1.2.js\r\n       npm:os-browserify@0.1.2/browser.js\r\n       npm:path-browserify@0.0.0.js\r\n       npm:path-browserify@0.0.0/index.js\r\n       npm:process@0.10.1.js\r\n       npm:process@0.10.1/browser.js\r\n       npm:typescript@1.5.3.js\r\n       npm:typescript@1.5.3/bin/typescript.js\r\n\r\nok   Built into build.js with source maps, unminified.\r\n```\r\nAll `.ts` files loaded using `System.import` are messed up.\r\nFor example, lets take a file `xxx.ts`, in its __xxx.ts!transpiled__ file there is a strange string, looks like a base64 of something, that appears at the end of the file.\r\n`xxx.ts!transpiled` example:\r\n```\r\n(function(__moduleName){System.register(['./zzz', './yyy' ], function(exports_1) {\r\n    // deleted code...\r\n    return {       \r\n         // deleted code...\r\n     }\r\n    }\r\n});\r\n\r\n// THIS IS THE STRANGE STRING:\r\neyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd0dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm5ndHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7UUFpQlcsTUFBTTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O1lBQU4sb0JBQUEsTUFBTSxHQUFHLE9BQU8sQ0FBQSxDQUFDO1lBTzVCLGdDQUFlLENBQUMsNEJBQWlCLEVBQUUsc0NBQXFCLENBQUMsVUFBVSxDQUFDLENBQUM7WUFDckUsZ0NBQWUsQ0FBQywyQkFBZ0IsRUFBRSxzQ0FBcUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztZQUNuRSxnQ0FBZSxDQUFDLHlCQUFjLEVBQUUsc0NBQXFCLENBQUMsT0FBTyxDQUFDLENBQUM7WUFFL0Qsa0JBQUksRUFBRSxDQUFDIn0=\r\n})(\"http://localhost:55000/src/xxx.ts\");\r\n```\r\n\r\nThings to note:\r\n -  if I remove the line `<script src=\"/build.js\"></script>` everything works, the dep's load automatically and transpiling works perfect.\r\n -  If I bundle xxx + typescript (`jspm bundle xxx + typescript`) again, everything works! but the next `.ts` I will load using System.import will fail with a similar error.\r\n\r\nIdeas?\r\n\r\n\r\n"}}