How to use the browserify.require function in browserify

To help you get started, we’ve selected a few browserify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github llafuente / js-2dmath / Gruntfile.js View on Github external
grunt.task.registerTask('browserify:debug', 'Generate debug files', function() {
        var done = this.async(),
            fs = require('fs'),
            output_stream = fs.createWriteStream('debug/js-2dmath-browser-debug.js');

        argumentify.verbose();

        argumentify.customValidators(argumentify_validators);

        require('browserify')()
            .require('./index.js', {expose: "js-2dmath"})
            .transform('argumentify')
            .bundle({
                debug: true
            })
            .pipe(output_stream);

        output_stream.on("close", function() {
            grunt.log.ok("work done");
            done();
        });
    });
github anvaka / npmgraph.an / gulpfile.js View on Github external
function produce3DBundle() {
  var bundle = require('browserify')()
    .require('./src/scripts/viewer/3d/renderer3d.js', { expose: 'renderer3d' });

  bundle
    .bundle()
    .on('error', function (err) {
      gutil.log(gutil.colors.red('Failed to browserify render3d'), gutil.colors.yellow(err.message));
    })
    .pipe(fs.createWriteStream(path.join(__dirname + '/dist/renderer3d.js')));

}
github llafuente / js-2dmath / Gruntfile.js View on Github external
grunt.task.registerTask('browserify:dist', 'Generate debug files', function() {
        var done = this.async(),
            browserify = require('browserify'),
            fs = require('fs'),
            stream;

        require('browserify')()
            .require('./index.js', {expose: "js-2dmath"})
            //.transform('funlinify')
            .bundle()
            .pipe(fs.createWriteStream('dist/js-2dmath-browser.js'))
            .on("close", function() {
                done();
            });
    });
github thlorenz / hypernal / example / build.js View on Github external
var build = module.exports = function () {
  return require('browserify')()
    .require(require.resolve('./main.js'), { entry: true })
    .bundle({ debug: true })
    .pipe(require('mold-source-map').transformSourcesRelativeTo(__dirname + '/../'));
};