title: Optimizing JS from WebJars using sbt-rjs in a Play 2.3.x app
body: <p>Is it possible to have a Play 2.3 app concat/optimize JS (using sbt-rjs) that's included in my app via WebJars?<br> To give a concrete example: I'm trying to create a <em>core.js</em> module which contains all my 3rd party libraries concatenated and minified in a single file which can then be specified as a dependency for other AMD modules.<br> It would be great to include these libraries via WebJars instead of downloading the source "manually".</p>
  
  <p>Here's a snippet from my <em>build.sbt</em> file where I'm specifying my webjar dependencies:</p>
  
  <pre><code>// Webjars
  libraryDependencies ++= Seq(
    "org.webjars" % "requirejs" % "2.1.15",
    "org.webjars" % "underscorejs" % "1.7.0",
    "org.webjars" % "jquery" % "1.11.1",
    "org.webjars" % "bootstrap" % "3.3.1" exclude("org.webjars", "jquery"),
    "org.webjars" % "angularjs" % "1.3.4-1" exclude("org.webjars", "jquery")
  )
  </code></pre>
  
  <p>Here's my requireJS build config</p>
  
  <pre><code>requirejs.config({
    baseUrl: '/assets/javascripts',
    shim: {
      'jsRoutes': {
        deps: [],
        exports: 'jsRoutes'
      },
      'angular': {
        deps: ['jquery'],
        exports: 'angular'
      },
      'underscore': {
        exports: '_'
      },
      'angularRoute': ['angular'],
      'angularCookies': ['angular'],
      'bootstrap': ['jquery']
    },
    paths: {
      'requirejs': '../lib/requirejs/require',
      'jquery': '../lib/jquery/jquery',
      'underscore': '../lib/underscorejs/underscore',
      'angular': '../lib/angularjs/angular',
      'angularRoute': '../lib/angularjs/angular-route',
      'angularCookies': '../lib/angularjs/angular-cookies',
      'bootstrap': '../lib/bootstrap/js/bootstrap',
      'jsRoutes': '/jsroutes',
      'core': './core'
    },
    modules: [
      {
        name: 'core'
      }
    ]
  });
  </code></pre>
  
  <p>And finally, here's my <em>core.js</em> module:</p>
  
  <pre><code>define(['angular', 'angularRoute', 'underscore', 'bootstrap'], function() {
    // core dependencies are loaded...
  });
  </code></pre>
  
  <p>After running <code>activator clean stage</code> from the command line I was hoping the built <em>core.js</em> file would include all my specified dependencies concatenated and minified into a single file, but it doesn't include any of them. If I specify a non-WebJar file as a dependency for <em>core.js</em>, it does optimize that correctly.</p>
  
  <p>Is what I'm trying to do possible? I've been googling quite a bit and haven't been able to find a clear answer either way.</p>
  
  <p>Thanks!</p>