Improve error message for missing variant

This commit is contained in:
Dave Wasmer 2020-05-04 22:26:55 -06:00 committed by GitHub
parent 7de73459b6
commit 93cddddaa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,9 @@ export default function(config, { variantGenerators: pluginVariantGenerators })
}
_.forEach(_.without(ensureIncludesDefault(variants), 'responsive'), variant => {
if (!variantGenerators[variant]) {
throw new Error(`Your config mentions the "${variant}" variant, but "${variant}" doesn't appear to be a variant. Did you forget or misconfigure a plugin that supplies that variant?`);
}
variantGenerators[variant](atRule, config)
})