Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit 43931f5

Browse files
TATSUNO Yasuhirokazupon
authored andcommitted
⚡ improvement(index): Suppress some warnings in production: smaller min.js and performance gain. (#441) by @ exoego
1 parent d75c90f commit 43931f5

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252
}
5353
})
5454

55-
if (hasPlaces && children.length > 0 && !everyPlace) {
55+
if (process.env.NODE_ENV !== 'production' && hasPlaces && children.length > 0 && !everyPlace) {
5656
warn('If places prop is set, all child elements must have place prop set.')
5757
}
5858

src/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ export default class VueI18n {
267267
const linkPlaceholder: string = link.substr(2).replace(bracketsMatcher, '')
268268

269269
if (visitedLinkStack.includes(linkPlaceholder)) {
270-
warn(`Circular reference found. "${link}" is already visited in the chain of ${visitedLinkStack.reverse().join(' <- ')}`)
270+
if (process.env.NODE_ENV !== 'production') {
271+
warn(`Circular reference found. "${link}" is already visited in the chain of ${visitedLinkStack.reverse().join(' <- ')}`)
272+
}
271273
return ret
272274
}
273275
visitedLinkStack.push(linkPlaceholder)
@@ -583,8 +585,10 @@ export default class VueI18n {
583585

584586
_n (value: number, locale: Locale, key: ?string, options: ?NumberFormatOptions): NumberFormatResult {
585587
/* istanbul ignore if */
586-
if (process.env.NODE_ENV !== 'production' && !VueI18n.availabilities.numberFormat) {
587-
warn('Cannot format a Number value due to not supported Intl.NumberFormat.')
588+
if (!VueI18n.availabilities.numberFormat) {
589+
if (process.env.NODE_ENV !== 'production') {
590+
warn('Cannot format a Number value due to not supported Intl.NumberFormat.')
591+
}
588592
return ''
589593
}
590594

0 commit comments

Comments
 (0)