Skip to content

Commit 4f186c5

Browse files
author
benholloway
committed
attempting to fix browerify-ngannotate source maps
1 parent 3773df4 commit 4f186c5

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/build/browserify.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var fs = require('fs');
22
var path = require('path');
33
var through = require('through2');
4+
var merge = require('lodash.merge');
45
var trackFilenames = require('gulp-track-filenames');
56
var transformTools = require('browserify-transform-tools');
67
var browserify = require('browserify');
@@ -230,10 +231,11 @@ function compile(bannerWidth, transforms) {
230231
// transforms
231232
transforms
232233
.concat(requireTransform(false))
233-
.filter(function (candidate) {
234-
return (typeof candidate === 'function');
235-
}).forEach(function (item) {
236-
bundler.transform(item, { global: true });
234+
.forEach(function (item, i, list) {
235+
if (typeof item === 'function') {
236+
var opts = (typeof list[i+1] === 'object') ? merge({ global: true }, list[i+1]) : { global: true };
237+
bundler.transform(item, opts);
238+
}
237239
});
238240

239241
// require statements

tasks/javascript.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ gulp.task('javascript:build', function () {
152152
function init() {
153153
cliArgs = cliArgs || yargs.resolveArgv();
154154
transforms = [
155-
to5ify.configure({ ignoreRegex: /(?!)/ }), // convert any es6 to es5 (ignoreRegex is degenerate)
156-
stringify({ minify: true }), // allow import of html to a string
157-
!cliArgs.unminified && ngAnnotate // @ngInject for angular injection points
155+
to5ify.configure({ ignoreRegex: /(?!)/ }), // convert any es6 to es5 (ignoreRegex is degenerate)
156+
stringify({ minify: true }), // allow import of html to a string
157+
!cliArgs.unminified && ngAnnotate, { sourcemap: true } // @ngInject for angular injection points
158158
];
159159
// TODO @bholloway fix sourcemaps in ngAnnotate so that it may be included even when not minifying
160160
}

0 commit comments

Comments
 (0)