title: shimming linkurious - how to configure?
body: <p>I'm trying to use the <a href="https://github.com/Linkurious/linkurious.js" rel="nofollow noreferrer">linkurious</a> library (a sigma fork), which provides a <code>"main": "dist/sigma.require.js"</code> (in the <code>package.json</code>).  this allows me to do:</p>
  
  <p><code>var sigma = require('linkurious');</code></p>
  
  <p>however, the plugins are not included so I have to require them separately.  the problem is that the plugins rely on the <code>sigma</code> variable being available in the global scope.  so I've shimmed things as follows (from the <code>package.json</code>):</p>
  
  <pre><code>  "browser": {
      "sigma": "./node_modules/linkurious/dist/sigma.js",
      "linkurious/plugins": "./node_modules/linkurious/dist/plugins.js"
    },  
    "browserify-shim": {
      "sigma": {"exports": "sigma"},
      "linkurious/plugins": { "depends": [ "sigma" ]  }   
    },  
    "browserify": {
      "transform": [ "browserify-shim" ]   
    }, 
  </code></pre>
  
  <p>which, when run in a browser doesn't generate errors during inclusion of the plugins (I gather this means the global variable is available) but references to the plugins fail (as if they failed to attach themselves, or attached themselves to a non-global variable).</p>
  
  <p>I'm using grunt-browserify to run the process where I have it configured like this (from the <code>Gruntfile.js</code>):</p>
  
  <pre><code>grunt.initConfig({
      browserify: {
          libs: {
              files: { 'inc.js': ['index.js'] },
          },
      }
  });
  </code></pre>
  
  <p>I've attached a little project to this issue with the minimal required code to demonstrate the problem in the hopes that someone else can replicate/figure out.  unpack, type <code>npm install; npm start</code> and run a browser against <code>http://localhost:8002/</code> to see the issue.</p>
  
  <p>thanks in advance,</p>
  
  <p>ekkis</p>
  
  <p><a href="https://github.com/thlorenz/browserify-shim/files/403028/sigma.zip" rel="nofollow noreferrer">sigma.zip</a></p>
  
  <p><strong>- edit I -</strong></p>
  
  <p>incidentally, bendrucker at the git repo (see: <a href="https://github.com/thlorenz/browserify-shim/issues/215" rel="nofollow noreferrer">https://github.com/thlorenz/browserify-shim/issues/215</a>) suggests I need to do a global transform.  It's been explained to me that shimming doesn't work on <code>node_modules</code> files and for those I need a global transform.  this doesn't make much sense to me as the whole point of shimming is that you don't own the code you're shimming.  in any case, bendrucker pointed me to <a href="https://stackoverflow.com/questions/35228943/allow-global-transforms-with-grunt-browserify">this other SO post</a> where the question is posed but no answers are provided.</p>
  
  <p>help?</p>