Skip to content

Commit

Permalink
Fix a bug occuring when outputPaths is undefined
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cahnory committed Jan 31, 2017
1 parent 35c9aa2 commit 56c412a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 56c412a

Please sign in to comment.