From 56c412a3fea69781647ac48d575a1031dcb603f5 Mon Sep 17 00:00:00 2001 From: cahnory Date: Tue, 31 Jan 2017 10:20:00 +0100 Subject: [PATCH] Fix a bug occuring when outputPaths is undefined When *outputPaths* is `undefined`, *outputPaths* is happened to an `array` resulting in an error at 44:42 > Cannot read property 'replace' of undefined I chosed to use the bundle name with html extension as default path. Empty string will be considered as undefined. I could have done: ``` this.outputPaths = Array.isArray(outputPaths) ? outputPaths : ['string' === typeof outputPaths ? outputPaths : renderSrc + '.html'] ``` but it seemed unjustified. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 0543ec8..6f4d941 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ var Promise = require('bluebird'); function StaticSiteGeneratorWebpackPlugin(renderSrc, outputPaths, locals, scope) { this.renderSrc = renderSrc; - this.outputPaths = Array.isArray(outputPaths) ? outputPaths : [outputPaths]; + this.outputPaths = Array.isArray(outputPaths) ? outputPaths : [ outputPaths || renderSrc + '.html' ]; this.locals = locals; this.scope = scope; }