Skip to content

Commit 95cc9f2

Browse files
authored
Merge pull request #900 from matrix-org/rav/fix_sourcemaps
Fix errors in embedded sourcemaps
2 parents aeead91 + 69bf88e commit 95cc9f2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

gulpfile.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var header = require('gulp-header');
99
var istanbul = require('gulp-istanbul');
1010
var jshint = require('gulp-jshint');
1111
var mocha = require('gulp-mocha');
12+
var sourcemaps = require('gulp-sourcemaps');
1213
var pkg = require('./package');
1314
var source = require('vinyl-source-stream');
1415
// Browser Unit Tests
@@ -18,7 +19,7 @@ var assign = require('object.assign');
1819
var connect = require('gulp-connect');
1920
var cors = require('connect-cors');
2021

21-
// This is a workaround for this bug...https://github.com/feross/buffer/issues/79
22+
// This is a workaround for this bug...https://github.com/feross/buffer/issues/79
2223
// Please refactor this, when the bug is resolved!
2324
// PS: you need to depend on [email protected]
2425
var OldBuffer = require.resolve('buffer/');
@@ -89,12 +90,18 @@ gulp.task('build', function (cb) {
8990
b.transform({global: true}, 'uglifyify');
9091
}
9192

92-
b.transform('brfs')
93+
var p = b.transform('brfs')
9394
.bundle()
9495
.pipe(source(basename + (!useDebug ? '.min' : '') + '.js'))
9596
.pipe(buffer())
96-
.pipe(header(banner, {pkg: pkg}))
97-
.pipe(gulp.dest('./browser/'))
97+
.pipe(sourcemaps.init({loadMaps: true}))
98+
.pipe(header(banner, {pkg: pkg}));
99+
100+
if (useDebug) {
101+
p = p.pipe(sourcemaps.write());
102+
}
103+
104+
p.pipe(gulp.dest('./browser/'))
98105
.on('error', function (err) {
99106
callback(err);
100107
})

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"gulp-istanbul": "^0.5.0",
5656
"gulp-jshint": "^1.9.0",
5757
"gulp-mocha": "^2.0.0",
58+
"gulp-sourcemaps": "^1.0.0",
5859
"http-server": "^0.8.0",
5960
"jshint-stylish": "^1.0.1",
6061
"karma": "^0.13.0",

0 commit comments

Comments
 (0)