{"action":"opened","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/498","repository_url":"https://api.github.com/repos/systemjs/builder","labels_url":"https://api.github.com/repos/systemjs/builder/issues/498/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/498/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/498/events","html_url":"https://github.com/systemjs/builder/issues/498","id":132825686,"number":498,"title":"Exception encountered when building app with a non-JS import handled by plugin loader","user":{"login":"dkrill","id":1213247,"avatar_url":"https://avatars.githubusercontent.com/u/1213247?v=3","gravatar_id":"","url":"https://api.github.com/users/dkrill","html_url":"https://github.com/dkrill","followers_url":"https://api.github.com/users/dkrill/followers","following_url":"https://api.github.com/users/dkrill/following{/other_user}","gists_url":"https://api.github.com/users/dkrill/gists{/gist_id}","starred_url":"https://api.github.com/users/dkrill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkrill/subscriptions","organizations_url":"https://api.github.com/users/dkrill/orgs","repos_url":"https://api.github.com/users/dkrill/repos","events_url":"https://api.github.com/users/dkrill/events{/privacy}","received_events_url":"https://api.github.com/users/dkrill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-10T21:43:53Z","updated_at":"2016-02-10T21:43:53Z","closed_at":null,"body":"After updating from systemjs-builder#0.14.11 to any newer version (0.14.12 <= 0.15.7), we encountered an exception thrown by `builder.buildStatic`. \r\n\r\n```\r\n[ERROR] Bundle failed: \r\n ›› MultipleErrors: template.sidebar.dust:1:1: Unexpected token <\r\ntemplate.sidebar.dust:1:2: Semi-colon expected\r\ntemplate.sidebar.dust:1:6: Unexpected token <\r\ntemplate.sidebar.dust:1:7: Semi-colon expected\r\ntemplate.sidebar.dust:1:16: Semi-colon expected\r\ntemplate.sidebar.dust:1:29: Unexpected token <\r\n...\r\n```\r\n\r\n`template.sidebar.dust` is a dust.js resource being loaded via a custom plugin. \r\n\r\n```\r\nimport template from './template.sidebar.dust!boneplate';\r\n\r\nexport default function() {\r\n  return template;\r\n}\r\n```\r\n\r\nThe plugin compiles and registers our template with dust, then outputs a module that exports the name of the template that it was registered with dust.  \r\n\r\n```\r\nimport compiler from 'dustjs-compiler';\r\nimport dust from 'dustjs-linkedin';\r\n\r\nfunction getTemplateName(name) {\r\n  // return name without the file extension\r\n}\r\n\r\nexport function translate(load) {\r\n  const templateName = getTemplateName(load.address.substr(load.address.lastIndexOf('/') + 1));\r\n\r\n  const template = load.source;\r\n  let compiled;\r\n  if (template.indexOf('(function(){dust.register') === 0 || template.indexOf('(function(dust){dust.register') === 0) {\r\n    compiled = template;\r\n  } else {\r\n    compiled = compiler.compile(template, templateName);\r\n  }\r\n  dust.loadSource(compiled);\r\n\r\n  return 'import dust from \"dustjs-linkedin\";' + compiled + 'export default \"' + templateName + '\";';\r\n}\r\n```\r\n\r\nIn 0.14.11, the build succeeds.  In 0.14.12 and later, something appears to be parsing the dust file source as script.\r\n\r\nI've created an example app that duplicates the issue:\r\nhttps://github.com/dkrill/systemjs-builder-plugin-issue\r\n\r\nRun `npm install`, then `gulp build`.  Decrement the version of `systemjs-builder` to 0.14.11 in `package.json` and the exception goes away.  The version of `systemjs` used doesn't appear to be a factor.\r\n"}}