@@ -23,9 +23,8 @@ var strictD3 = require('./strict_d3');
23
23
* - noCompress {boolean} skip attribute meta compression?
24
24
* @param {function } cb callback
25
25
*
26
- * Outputs one bundle (un-minified) file if opts.pathToMinBundle is omitted
27
- * or opts.debug is true. Otherwise outputs two file: one un-minified bundle and
28
- * one minified bundle.
26
+ * Outputs one bundle (un-minified) file if opts.pathToMinBundle is omitted.
27
+ * Otherwise outputs two file: one un-minified bundle and one minified bundle.
29
28
*
30
29
* Logs basename of bundle when completed.
31
30
*/
@@ -36,7 +35,8 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts, cb) {
36
35
37
36
var browserifyOpts = { } ;
38
37
browserifyOpts . standalone = opts . standalone ;
39
- browserifyOpts . debug = opts . debug ;
38
+ var sourceMap = opts . pathToSourceMap ;
39
+ browserifyOpts . debug = opts . debug || sourceMap ;
40
40
41
41
if ( opts . noCompress ) {
42
42
browserifyOpts . ignoreTransform = './tasks/compress_attributes.js' ;
@@ -72,10 +72,18 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts, cb) {
72
72
} ) ;
73
73
}
74
74
75
- if ( pathToBundle ) {
75
+ if ( sourceMap ) {
76
+ bundleStream
77
+ . pipe ( applyDerequire ( ) )
78
+ . pipe ( exorcist ( sourceMap ) )
79
+ . pipe ( fs . createWriteStream ( pathToBundle ) )
80
+ . on ( 'finish' , function ( ) {
81
+ logger ( pathToBundle ) ;
82
+ done ( ) ;
83
+ } ) ;
84
+ } else {
76
85
bundleStream
77
86
. pipe ( applyDerequire ( ) )
78
- . pipe ( exorcist ( pathToBundle + '.map' ) )
79
87
. pipe ( fs . createWriteStream ( pathToBundle ) )
80
88
. on ( 'finish' , function ( ) {
81
89
logger ( pathToBundle ) ;
0 commit comments