feat: warnOnce & graceful error handling

This commit is contained in:
Igor Randjelovic
2021-04-01 17:55:45 +02:00
parent 7edb1e90b0
commit 1627f52043
4 changed files with 40 additions and 8 deletions

View File

@ -28,6 +28,16 @@ export function warn(...data: any): void {
console.warn(`[@nativescript/webpack] Warn: \n`, ...cleanup(data));
}
const warnedMap: any = {};
export function warnOnce(key: string, ...data: any): void {
if (warnedMap[key]) {
return;
}
warnedMap[key] = true;
warn(...data);
}
export function info(...data: any): void {
if (env.verbose) {
console.log(`[@nativescript/webpack] Info: \n`, ...cleanup(data));