Attamusc / gulp-esperanto

Gulp plugin to transpile ES6 module syntax with esperanto
2 stars 5 forks source link

Support bundle #2

Open jamesplease opened 9 years ago

jamesplease commented 9 years ago

Do you have any interest in supporting esperanto's bundle feature? If so, I can help implement it

jamesplease commented 9 years ago

nvm. You can support bundle without using this plugin at all.

  esperanto.bundle({
    base: 'src',
    entry: 'index.js',
  }).then(function(bundle) {
    res = bundle.toUmd({
      name: 'myLib'
    });

    $.file('lib.js', res.code, { src: true })
      .pipe(gulp.dest('dist'))
      .on('end', done);
  });
Attamusc commented 9 years ago

@jmeas ideally this is something I'd want the plugin to support. I haven't looked into it yet as our specific uses of esperanto are fairly behind.

jamesplease commented 9 years ago

Mmk, cool @Attamusc. In the meantime, for future visitors, here's an implementation that uses esperanto directly.

lukemcgregor commented 9 years ago

+1 on bundles

lukemcgregor commented 9 years ago

@jmeas Im not too sure what babel does in your script, my understanding is that esperanto will already do the same stuff? Perhaps I'm not understanding the difference between babel and esperanto

jamesplease commented 9 years ago

Esperanto is a bundler for scripts that use ES2015 module syntax.

Babel is a transpiler that supports most of ES2015 features.

For instance,

window.setTimeout(() => {
  console.log('hello');
});

will work if you transpile it first with Babel, but not if you only use Esperanto.

Esperanto offers more module-related features than Babel's implementation, so I use Esperanto for modules and Babel for everything else.

lukemcgregor commented 9 years ago

@jmeas Ahh that makes more sense, I just thought they were competing modules. Thanks for the clarification. I'm pretty new to ES6, and modules are the bit I'm most excited about so thats probably why they looked the same