Skip to content

Commit b23baad

Browse files
Fix for case where no options are passed or options is not an object, causing the plugin to crash.
1 parent 343c4d0 commit b23baad

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

index.js

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

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

0 commit comments

Comments
 (0)