File tree 2 files changed +40
-2
lines changed
2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,14 @@ module.exports = {
49
49
let description = `000${ ++ count } ` . slice ( - 3 ) ;
50
50
let postDebugTree = this . _debugTree ( inputTree , `${ description } :input` ) ;
51
51
52
- let BabelTranspiler = require ( 'broccoli-babel-transpiler' ) ;
53
- let output = new BabelTranspiler ( postDebugTree , this . buildBabelOptions ( config ) ) ;
52
+ let options = this . buildBabelOptions ( config ) ;
53
+ let output ;
54
+ if ( this . _shouldDoNothing ( options ) ) {
55
+ output = postDebugTree ;
56
+ } else {
57
+ let BabelTranspiler = require ( 'broccoli-babel-transpiler' ) ;
58
+ output = new BabelTranspiler ( postDebugTree , options ) ;
59
+ }
54
60
55
61
return this . _debugTree ( output , `${ description } :output` ) ;
56
62
} ,
@@ -378,4 +384,9 @@ module.exports = {
378
384
379
385
return checker . exists ( ) ;
380
386
} ,
387
+
388
+ // detect if running babel would do nothing... and do nothing instead
389
+ _shouldDoNothing ( options ) {
390
+ return ! options . sourceMaps && ! options . plugins . length ;
391
+ }
381
392
} ;
Original file line number Diff line number Diff line change @@ -343,6 +343,33 @@ describe('ember-cli-babel', function() {
343
343
} ) ) ;
344
344
345
345
} ) ;
346
+
347
+ describe ( '_shouldDoNothing' , function ( ) {
348
+ it ( "will no-op if nothing to do" , co . wrap ( function * ( ) {
349
+ input . write ( {
350
+ "foo.js" : `invalid code`
351
+ } ) ;
352
+
353
+ subject = this . addon . transpileTree ( input . path ( ) , {
354
+ 'ember-cli-babel' : {
355
+ compileModules : false ,
356
+ disablePresetEnv : true ,
357
+ disableDebugTooling : true ,
358
+ disableEmberModulesAPIPolyfill : true
359
+ }
360
+ } ) ;
361
+
362
+ output = createBuilder ( subject ) ;
363
+
364
+ yield output . build ( ) ;
365
+
366
+ expect (
367
+ output . read ( )
368
+ ) . to . deep . equal ( {
369
+ "foo.js" : `invalid code`
370
+ } ) ;
371
+ } ) ) ;
372
+ } ) ;
346
373
} ) ;
347
374
348
375
describe ( '_getAddonOptions' , function ( ) {
You can’t perform that action at this time.
0 commit comments