diff --git a/CHANGELOG.md b/CHANGELOG.md
index 431d9857..379b504b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [3.0.5](https://github.com/webpack-contrib/karma-webpack/compare/v3.0.4...v3.0.5) (2018-09-14)
+
+
+### Bug Fixes
+
+* **karma-webpack:** handle multiple outputs correctly ([#357](https://github.com/webpack-contrib/karma-webpack/issues/357)) ([59de62c](https://github.com/webpack-contrib/karma-webpack/commit/59de62c))
+
+
+
## [3.0.4](https://github.com/webpack-contrib/karma-webpack/compare/v3.0.3...v3.0.4) (2018-09-07)
diff --git a/package-lock.json b/package-lock.json
index 1b57557c..fbc7d316 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "karma-webpack",
- "version": "3.0.4",
+ "version": "3.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index bab20bb0..d8af7059 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "karma-webpack",
- "version": "3.0.4",
+ "version": "3.0.5",
"author": "Tobias Koppers @sokra",
"description": "Use webpack with karma",
"license": "MIT",
diff --git a/src/karma-webpack.js b/src/karma-webpack.js
index 232cce60..8a78db55 100644
--- a/src/karma-webpack.js
+++ b/src/karma-webpack.js
@@ -237,7 +237,11 @@ Plugin.prototype.readFile = function(file, callback) {
var doRead = function() {
if (optionsCount > 1) {
async.times(optionsCount, function(idx, callback) {
- middleware.fileSystem.readFile(path.join(os.tmpdir(), '_karma_webpack_', String(idx), this.outputs[file]), callback)
+ if (Array.isArray(this.outputs[file])) {
+ middleware.fileSystem.readFile(path.join(os.tmpdir(), '_karma_webpack_', String(idx), this.outputs[file][0]), callback);
+ } else {
+ middleware.fileSystem.readFile(path.join(os.tmpdir(), '_karma_webpack_', String(idx), this.outputs[file]), callback);
+ }
}.bind(this), function(err, contents) {
if (err) {
return callback(err)
@@ -253,8 +257,13 @@ Plugin.prototype.readFile = function(file, callback) {
callback(null, Buffer.concat(contents))
})
} else {
- try {
- var fileContents = middleware.fileSystem.readFileSync(path.join(os.tmpdir(), '_karma_webpack_', this.outputs[file]))
+ try {
+ var fileContents = ''
+ if (Array.isArray(this.outputs[file])) {
+ fileContents = middleware.fileSystem.readFileSync(path.join(os.tmpdir(), '_karma_webpack_', this.outputs[file][0]));
+ } else {
+ fileContents = middleware.fileSystem.readFileSync(path.join(os.tmpdir(), '_karma_webpack_', this.outputs[file]));
+ }
callback(undefined, fileContents)
} catch (e) {
@@ -297,7 +306,11 @@ function createPreprocesor(/* config.basePath */ basePath, webpackPlugin) {
}
var outputPath = webpackPlugin.outputs[normalize(filename)]
- file.path = normalize(path.join(basePath, outputPath))
+ if( Array.isArray(outputPath)){
+ file.path = normalize(path.join(basePath, outputPath[0]));
+ } else {
+ file.path = normalize(path.join(basePath, outputPath));
+ }
done(err, content && content.toString())
})