From 6e417d2d23985312007df51bf6a9054dff096fc6 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sun, 19 Mar 2017 02:20:35 +0900 Subject: [PATCH] :zap: improvement(warn): suppress warning messages for production --- src/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 060f31114..b3aac1f51 100644 --- a/src/index.js +++ b/src/index.js @@ -118,7 +118,9 @@ export default class VueI18n { if (isPlainObject(message)) { ret = message[key] if (typeof ret !== 'string') { - warn(`Value of key '${key}' is not a string!`) + if (process.env.NODE_ENV !== 'production') { + warn(`Value of key '${key}' is not a string!`) + } return null } } else { @@ -128,7 +130,9 @@ export default class VueI18n { if (typeof pathRet === 'string') { ret = pathRet } else { - warn(`Value of key '${key}' is not a string!`) + if (process.env.NODE_ENV !== 'production') { + warn(`Value of key '${key}' is not a string!`) + } return null } }