Skip to content

Commit dc05951

Browse files
committed
Merge pull request #17 from frederickfogerty/options-undefined-patch
Fix for case where no options are passed or options is not an object, causing the plugin to crash.
2 parents 0ebcd26 + b990344 commit dc05951

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ function localizeDecl(decl, context) {
189189
}
190190

191191
module.exports = postcss.plugin('postcss-modules-local-by-default', function (options) {
192+
if (typeof options !== 'object') {
193+
options = {}; // If options is undefined or not an object the plugin fails
194+
}
192195
if(options && options.mode) {
193196
if(options.mode !== "global" && options.mode !== "local" && options.mode !== "pure") {
194197
throw new Error("options.mode must be either 'global', 'local' or 'pure' (default 'local')");

0 commit comments

Comments
 (0)