diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 7ba32b857..841c60ecf 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -36,7 +36,14 @@ export interface SFCScriptCompileOptions { refSugar?: boolean } -let hasWarned = false +const hasWarned: Record = {} + +function warnOnce(msg: string) { + if (!hasWarned[msg]) { + hasWarned[msg] = true + console.log(`\n\x1b[33m[@vue/compiler-sfc] %s\x1b[0m\n`, msg) + } +} /** * Compile `