2020-11-18 07:54:47 +08:00
|
|
|
const hasWarned: Record<string, boolean> = {}
|
|
|
|
|
|
|
|
export function warnOnce(msg: string) {
|
2020-11-20 09:36:15 +08:00
|
|
|
const isNodeProd =
|
|
|
|
typeof process !== 'undefined' && process.env.NODE_ENV === 'production'
|
|
|
|
if (!isNodeProd && !__TEST__ && !hasWarned[msg]) {
|
2020-11-18 07:54:47 +08:00
|
|
|
hasWarned[msg] = true
|
|
|
|
warn(msg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function warn(msg: string) {
|
2020-11-20 09:36:15 +08:00
|
|
|
console.warn(
|
|
|
|
`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`
|
|
|
|
)
|
|
|
|
}
|