@@ -237,7 +237,11 @@ Plugin.prototype.readFile = function(file, callback) {
237237 var doRead = function ( ) {
238238 if ( optionsCount > 1 ) {
239239 async . times ( optionsCount , function ( idx , callback ) {
240- middleware . fileSystem . readFile ( path . join ( os . tmpdir ( ) , '_karma_webpack_' , String ( idx ) , this . outputs [ file ] ) , callback )
240+ if ( Array . isArray ( this . outputs [ file ] ) ) {
241+ middleware . fileSystem . readFile ( path . join ( os . tmpdir ( ) , '_karma_webpack_' , String ( idx ) , this . outputs [ file ] [ 0 ] ) , callback ) ;
242+ } else {
243+ middleware . fileSystem . readFile ( path . join ( os . tmpdir ( ) , '_karma_webpack_' , String ( idx ) , this . outputs [ file ] ) , callback ) ;
244+ }
241245 } . bind ( this ) , function ( err , contents ) {
242246 if ( err ) {
243247 return callback ( err )
@@ -253,8 +257,13 @@ Plugin.prototype.readFile = function(file, callback) {
253257 callback ( null , Buffer . concat ( contents ) )
254258 } )
255259 } else {
256- try {
257- var fileContents = middleware . fileSystem . readFileSync ( path . join ( os . tmpdir ( ) , '_karma_webpack_' , this . outputs [ file ] ) )
260+ try {
261+ var fileContents = ''
262+ if ( Array . isArray ( this . outputs [ file ] ) ) {
263+ fileContents = middleware . fileSystem . readFileSync ( path . join ( os . tmpdir ( ) , '_karma_webpack_' , this . outputs [ file ] [ 0 ] ) ) ;
264+ } else {
265+ fileContents = middleware . fileSystem . readFileSync ( path . join ( os . tmpdir ( ) , '_karma_webpack_' , this . outputs [ file ] ) ) ;
266+ }
258267
259268 callback ( undefined , fileContents )
260269 } catch ( e ) {
@@ -297,7 +306,11 @@ function createPreprocesor(/* config.basePath */ basePath, webpackPlugin) {
297306 }
298307
299308 var outputPath = webpackPlugin . outputs [ normalize ( filename ) ]
300- file . path = normalize ( path . join ( basePath , outputPath ) )
309+ if ( Array . isArray ( outputPath ) ) {
310+ file . path = normalize ( path . join ( basePath , outputPath [ 0 ] ) ) ;
311+ } else {
312+ file . path = normalize ( path . join ( basePath , outputPath ) ) ;
313+ }
301314
302315 done ( err , content && content . toString ( ) )
303316 } )
0 commit comments