{"action":"created","issue":{"url":"https://api.github.com/repos/jspm/jspm-cli/issues/906","labels_url":"https://api.github.com/repos/jspm/jspm-cli/issues/906/labels{/name}","comments_url":"https://api.github.com/repos/jspm/jspm-cli/issues/906/comments","events_url":"https://api.github.com/repos/jspm/jspm-cli/issues/906/events","html_url":"https://github.com/jspm/jspm-cli/issues/906","id":93020881,"number":906,"title":"jspm install munges sass.worker.js file at install","user":{"login":"theefer","id":36964,"avatar_url":"https://avatars.githubusercontent.com/u/36964?v=3","gravatar_id":"","url":"https://api.github.com/users/theefer","html_url":"https://github.com/theefer","followers_url":"https://api.github.com/users/theefer/followers","following_url":"https://api.github.com/users/theefer/following{/other_user}","gists_url":"https://api.github.com/users/theefer/gists{/gist_id}","starred_url":"https://api.github.com/users/theefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theefer/subscriptions","organizations_url":"https://api.github.com/users/theefer/orgs","repos_url":"https://api.github.com/users/theefer/repos","events_url":"https://api.github.com/users/theefer/events{/privacy}","received_events_url":"https://api.github.com/users/theefer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-04T15:19:14Z","updated_at":"2015-07-05T14:59:49Z","closed_at":null,"body":"When installing the `npm:sass.js` package, JSPM seems to be rewriting the file at `dist/sass.worker.js` by (1) expanding the lines (previously minimised), causing the file to bloat in size, and (2) by injected dependencies into a form of CommonJS IIFE, which breaks the script when run as a Web Worker in the browser.\r\n\r\nSee file installed via JSPM:\r\n\r\n```\r\n$ du -sch jspm_packages/npm/sass.js@0.9.2/dist/sass.worker.js \r\n7.7M    jspm_packages/npm/sass.js@0.9.2/dist/sass.worker.js\r\n\r\n$ head -n 5 jspm_packages/npm/sass.js@0.9.2/dist/sass.worker.js \r\n/* */ \r\n(function(Buffer, process) {\r\n  var Module = {onRuntimeInitialized: function() {\r\n      'use strict';\r\n      Sass._ready();\r\n\r\n$ tail -n 5 jspm_packages/npm/sass.js@0.9.2/dist/sass.worker.js \r\n      });\r\n    }\r\n    method.apply(Sass, (event.data.args || []).concat([done]));\r\n  };\r\n})(require(\"buffer\").Buffer, require(\"process\"));\r\n```\r\n\r\nvs file installed via npm:\r\n\r\n```\r\n$ du -sch node_modules/sass.js/dist/sass.worker.js \r\n2.6M    node_modules/sass.js/dist/sass.worker.js\r\n\r\n$ head -n 10 node_modules/sass.js/dist/sass.worker.js  \r\n/*! sass.js - v0.9.2 (e355668) - built 2015-06-14\r\n  providing libsass 3.2.5 (0e6b4a2)\r\n  via emscripten 1.33.1 (ae2f801)\r\n */\r\n/*global Sass*/\r\nvar Module = {\r\n  onRuntimeInitialized: function() {\r\n    'use strict';\r\n    Sass._ready();\r\n  }\r\n\r\n$ tail -n 10 node_modules/sass.js/dist/sass.worker.js  \r\n\r\n  if (!method) {\r\n    return done({\r\n      line: 0,\r\n      message: 'Unknown command ' + event.action\r\n    });\r\n  }\r\n\r\n  method.apply(Sass, (event.data.args || []).concat([done]));\r\n};\r\n```\r\n\r\n**Update: corrected head/tail for npm installed sass.js**\r\n\r\nThis has been reproduced both with JSPM 0.15 and 0.16.\r\n\r\nThis problem was found when working on a [Sass plugin for SystemJS](https://github.com/theefer/plugin-sass)."},"comment":{"url":"https://api.github.com/repos/jspm/jspm-cli/issues/comments/118629343","html_url":"https://github.com/jspm/jspm-cli/issues/906#issuecomment-118629343","issue_url":"https://api.github.com/repos/jspm/jspm-cli/issues/906","id":118629343,"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-07-05T14:59:49Z","updated_at":"2015-07-05T14:59:49Z","body":"How does the above break in a web worker? These conversions are part of making node modules work in jspm, so happy to add a fix to them, but the rewriting is important."}}