How to use babelify - 9 common examples

To help you get started, we’ve selected a few babelify 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 sergiocruz / react-connect4 / gulpfile.babel.js View on Github external
import watchify from 'watchify';
import exorcist from 'exorcist';
import browserify from 'browserify';
import browserSync from 'browser-sync';
import sass from 'gulp-sass';

// Browsersync Reload
const reload = browserSync.reload;

// Input file.
watchify.args.debug = true;
// let bundler = watchify(browserify('app/client.js', watchify.args));
let bundler = browserify('app/client.js', watchify.args);

// Babel transform
bundler.transform(babelify.configure({
  sourceMapRelative: 'app'
}));

// On updates recompile
bundler.on('update', bundle);

function bundle() {

  gutil.log('Compiling JS...');

  return bundler.bundle()
    .on('error', (err) => {
      gutil.log(err.message);
      browserSync.notify('Browserify Error!');
      this.emit('end');
    })
github jilieryuyi / wing-binlog / web / vendors / parsleyjs / gulpfile.babel.js View on Github external
function browserifyBundler() {
  // Our browserify bundle is made up of our unit tests, which
  // should individually load up pieces of our application.
  // We also include the browserify setup file.
  const testFiles = glob.sync('./test/unit/**/*.js');
  const allFiles = ['./test/setup/browserify.js'].concat(testFiles);

  // Create our bundler, passing in the arguments required for watchify
  watchify.args.debug = true;
  const bundler = browserify(allFiles, watchify.args);

  // Set up Babelify so that ES6 works in the tests
  bundler.transform(babelify.configure({
    sourceMapRelative: __dirname + '/src'
  }));

  return bundler;
}
github plouc / thumbor-toy / gulp / tasks / js.js View on Github external
function getBundler(isDev) {
    var bundler = browserify({
        entries:      ['./src/js/App.jsx'],
        extensions:   ['.js', '.jsx'],
        debug:        isDev,
        cache:        {},  // for watchify
        packageCache: {},  // for watchify
        fullPaths:    true // for watchify
    });

    bundler.transform(babelify.configure({
        optional: []
    }));

    return bundler;
}
github tbloncar / linemate / gulpfile.js View on Github external
function compile(watch) {
  var bundler = watchify(browserify('./src/linemate.js', { debug: true }).transform(babelify.configure({
    plugins: ['object-assign']
  })));

  function rebundle() {
    bundler.bundle()
      .on('error', function(err) { console.error(err); this.emit('end'); })
      .pipe(source('linemate.min.js'))
      .pipe(buffer())
      .pipe(uglify())
      .pipe(sourcemaps.init({ loadMaps: true }))
      .pipe(sourcemaps.write('./'))
      .pipe(gulp.dest('./dist'))
      .pipe(gulp.dest('./demo'));
  }

  if (watch) {
github battesonb / trees.js / canvas / gulpfile.js View on Github external
function compile(watch) {
  var bundler = watchify(browserify('./src/main.ts', { debug: true }).plugin(tsify, {target: 'es6'}).transform(babelify.configure({extensions: [".ts",".js"]})));

  function rebundle() {
    bundler.bundle()
      .on('error', function(err) { console.error(err); this.emit('end'); })
      .pipe(source('trees.bundle.js'))
      .pipe(buffer())
      .pipe(sourcemaps.init({ loadMaps: true }))
      .pipe(sourcemaps.write('./'))
      .pipe(gulp.dest('./dist'));
  }

  if (watch) {
    gulp.watch('./src/**').on("change", function() {
      console.log('-> bundling...');
      rebundle();
    });
github arnthor3 / react-bootstrap-toggle / gulpfile.js View on Github external
function compile(watch) {
  var bundler = watchify(
                  browserify('./src/react-bootstrap-toggle.js', { debug: true })
                  .transform(babel.configure({presets: ["es2015", "react"]}))
                );

  function rebundle() {
    bundler.bundle()
      .on('error', function(err) { console.error(err); this.emit('end'); })
      .pipe(source('react-bootstrap-toggle.js'))
      .pipe(buffer())
      .pipe(sourcemaps.init({ loadMaps: true }))
      .pipe(sourcemaps.write('./dist'))
      .pipe(gulp.dest('./dist'));
  }

  if (watch) {
    bundler.on('update', function() {
      console.log('-> bundling...');
      rebundle();
github sketch-hq / svgo-compressor / gulpfile.js View on Github external
gulp.task('bundle', function () {
  var filePath = './src/plugin.js';
  var extensions = ['.js'];

  var bundler = browserify({
    entries: [filePath],
    extensions: extensions,
    debug: false
  });

  bundler.transform(babelify.configure({
    presets: ["es2015"],
    plugins: [["babel-plugin-sketch-manifest-processor", ManifestProcessorOptions]]
  }));

  return bundler.bundle()
    .on('error',(function(arg) {
      console.log(arg.message);
    }))
    .pipe(source(ManifestProcessorOptions.scriptFileName))
    .pipe(gulp.dest('./build/'));
});
github bokuweb / re-resizable / karma.conf.js View on Github external
frameworks: ['mocha', 'browserify', 'fixture'],

    files: [
      './node_modules/babel-polyfill/dist/polyfill.js',
      'test/*.js',
      'test/fixtures.html',
    ],

    exclude: [
    ],

    browserify: {
      debug: true,
      extensions: ['.js'],
      transform: [
        require('babelify').configure({
          plugins: ['babel-plugin-espower'],
        }),
      ],
    },

    preprocessors: {
      'test/*.html': 'html2js',
      'test/*.js': ['browserify'],
    },

    reporters: ['progress'],

    port: 9876,

    colors: true,
github robmclarty / paginated-redux / gulpfile.js View on Github external
gulp.task('build', function () {
  const browserifyOptions = {
    entries: ['./src/paginated-redux'],
    debug: false,
    fullPaths: false
  };
  const babelifyOptions = {
    presets: ['es2015'],
    plugins: [
      'transform-object-rest-spread',
      'transform-es2015-modules-commonjs'
    ]
  };
  const stream = browserify(browserifyOptions)
    .transform(babelify.configure(babelifyOptions));

  return stream
    .bundle()
    .pipe(source('paginated-redux.min.js'))
    .pipe(buffer())
    .pipe(uglify())
    .pipe(gulp.dest('./dist'));
});

babelify

Babel browserify transform

MIT
Latest version published 6 years ago

Package Health Score

74 / 100
Full package analysis

Popular babelify functions

Similar packages