File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -76,13 +76,18 @@ StubGenerator.prototype.build = function() {
76
76
77
77
var content = fs . readFileSync ( fullInputPath , 'UTF8' ) ;
78
78
var imports = importsFor ( content , fullInputPath ) ;
79
+ var needsImportsReWritten = false ;
79
80
80
81
Object . keys ( imports ) . forEach ( function ( name ) {
82
+ needsImportsReWritten = true ;
81
83
imports [ name ] . version = versionForModuleName ( name , this . basedir ) ;
82
84
} , this ) ;
83
85
84
- // TODO: only add files that required rewriting
85
- fs . writeFileSync ( fullOutputPath , rewriteImports ( content , imports ) ) ;
86
+ if ( needsImportsReWritten ) {
87
+ fs . writeFileSync ( fullOutputPath , rewriteImports ( content , imports ) ) ;
88
+ } else {
89
+ fs . writeFileSync ( fullOutputPath , content ) ;
90
+ }
86
91
87
92
this . stubs . set ( fullInputPath , imports ) ;
88
93
You can’t perform that action at this time.
0 commit comments