Skip to content

Instantly share code, notes, and snippets.

@jakepusateri
Created June 10, 2019 01:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakepusateri/79657ca9bbb1f2e74780af7d91ba9626 to your computer and use it in GitHub Desktop.
Save jakepusateri/79657ca9bbb1f2e74780af7d91ba9626 to your computer and use it in GitHub Desktop.
const BLACKLIST = ['qs'];
gulp.task('check-blacklist', () => {
const stats = require('./build/stats.json');
const errors = [];
stats.children[0].modules.forEach(m => {
m.reasons.forEach(r => {
BLACKLIST.forEach(bl => {
if (r.userRequest === bl) {
errors.push(`Blacklisted module "${bl}" found requested by ${r.module}`);
}
});
});
});
if (errors.length > 0) {
throw new Error(`Blacklisted modules detected\n\n${errors.join('\n')}\n`);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment