Created
June 10, 2019 01:20
-
-
Save jakepusateri/79657ca9bbb1f2e74780af7d91ba9626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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