mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
feat: warnOnce & graceful error handling
This commit is contained in:
@ -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));
|
||||
|
Reference in New Issue
Block a user