How to use the browserify/lib/builtins.buffer 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 swagger-api / swagger-js / gulpfile.js View on Github external
var sourcemaps = require('gulp-sourcemaps');
var pkg = require('./package');
var source = require('vinyl-source-stream');
// Browser Unit Tests
var Karma = require('karma').Server;
var karmaConfig = require('./karma.conf');
var assign = require('object.assign');
var connect = require('gulp-connect');
var cors = require('connect-cors');

// This is a workaround for this bug...https://github.com/feross/buffer/issues/79
// Please refactor this, when the bug is resolved!
// PS: you need to depend on buffer@3.4.3
var OldBuffer = require.resolve('buffer/');
var builtinsOverride = require('browserify/lib/builtins');
builtinsOverride.buffer = OldBuffer;

var banner = ['/**',
  ' * <%= pkg.name %> - <%= pkg.description %>',
  ' * @version v<%= pkg.version %>',
  ' * @link <%= pkg.homepage %>',
  ' * @license <%= pkg.license %>',
  ' */',
  ''].join('\n');
var basename = 'swagger-client';
var paths = {
  sources: ['index.js', 'lib/**/*.js'],
  tests: ['test/*.js', 'test/compat/*.js', 'test/both/*.js'],
  dist: 'browser'
};

paths.all = paths.sources.concat(paths.tests).concat(['gulpfile.js']);