gulp-jspm-build icon indicating copy to clipboard operation
gulp-jspm-build copied to clipboard

Synchronously processing bundles

Open ericsvendsen opened this issue 9 years ago • 2 comments

I'm trying to bundle my dependencies and app code separately using arithmetic, for example:

jspm({bundles: [ { src: 'app.js - [app/**/*]', dst: 'deps.bundle.js' }, { src: 'app.js - deps.bundle.js', dst: 'app.bundle.js'} ]}).pipe(gulp.dest('build'));

Since the file deps.bundle.js needs to be created first, I'm getting an error that it doesn't exist, presumably because those bundles are being processed asynchronously. I can make this work with two separate Gulp tasks, but I was curious if there was a way to make this work synchronously in just one task.

ericsvendsen avatar Feb 12 '16 20:02 ericsvendsen

Using the resulting bundles in bundle expressions is not supported. One way to work around this would be using negative globs.

app = ['app/**/*'];
deps = ['!app/**/*'];

buddhike avatar Feb 12 '16 22:02 buddhike

I tried using a negative glob, but the [module] syntax mentioned in the systemjs docs doesn't seem to allow this. Inserting an exclamation point before the glob causes systemjs to look for a file named *.js - not a pattern of *.js but rather an actual file. The syntax also doesn't allow for quotes around the glob.

I tried googling for a while and I can't find any other examples or documentation that would support negative globs in this context, unfortunately. Not saying it's impossible, just that I can't make it work for some reason.

Regardless, it's not a huge deal to split my bundling into two separate tasks. This is actually helpful since then during development it allows me to only rebundle my app code when a file is changed. Thanks for your help and for a great plugin!

ericsvendsen avatar Feb 13 '16 05:02 ericsvendsen