browserify package: how to expose library inside window object?
<p>I'm trying to bundle my library into a <code>.js</code> file that would be loadable from a script tag. I want to have my library available under a variable in the browser console (in other words, I want to export it into <code>window</code> object). How can I do it in browserify?</p>

<p>This is my existing grunt-browserify config:</p>

<pre><code>browserify: {
  options: {
    watch: "on",
    banner: "&lt;%= banner %&gt;",
    browserifyOptions: {
      insertGlobalVars: "on",
      noBuiltins: true,
      detectGlobals: false
    }
  },
  dist: {
    files: {
      'dist/json-schema-faker.js': ['lib/index.js']
    }
  }
</code></pre>

<p>Currently I can't use my bundled library from <strong>outside</strong> the package.</p>

<p>I know that browserify supports <a href="https://github.com/substack/node-browserify#external-requires" rel="nofollow">External requires</a>, but instead of</p>

<pre><code>var jsf = require('json-schema-faker');
jsf.doSomething();
</code></pre>

<p>I would prefer to do:</p>

<pre><code>jsf.doSomething();
</code></pre>

<p>directly (so that assigning <code>jsf</code> to <code>window</code> would be automatic). How to do that, what are the possibilities of browserify in that matter?</p>