@@ -237,7 +237,11 @@ Plugin.prototype.readFile = function(file, callback) {
237
237
var doRead = function ( ) {
238
238
if ( optionsCount > 1 ) {
239
239
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
+ }
241
245
} . bind ( this ) , function ( err , contents ) {
242
246
if ( err ) {
243
247
return callback ( err )
@@ -253,8 +257,13 @@ Plugin.prototype.readFile = function(file, callback) {
253
257
callback ( null , Buffer . concat ( contents ) )
254
258
} )
255
259
} 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
+ }
258
267
259
268
callback ( undefined , fileContents )
260
269
} catch ( e ) {
@@ -297,7 +306,11 @@ function createPreprocesor(/* config.basePath */ basePath, webpackPlugin) {
297
306
}
298
307
299
308
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
+ }
301
314
302
315
done ( err , content && content . toString ( ) )
303
316
} )
0 commit comments