diff --git a/components/index.js b/components/index.js index 450810a7a2..b2edcc2abc 100644 --- a/components/index.js +++ b/components/index.js @@ -30,7 +30,9 @@ function loadLanguages(languages) { getLoader(components, languages, loaded).load(lang => { if (!(lang in components.languages)) { - console.warn('Language does not exist: ' + lang); + if (!loadLanguages.silent) { + console.warn('Language does not exist: ' + lang); + } return; } @@ -46,4 +48,9 @@ function loadLanguages(languages) { }); } +/** + * Set this to `true` to prevent all warning messages `loadLanguages` logs. + */ +loadLanguages.silent = false; + module.exports = loadLanguages; diff --git a/index.html b/index.html index f8451860b4..ab2bfd0e57 100644 --- a/index.html +++ b/index.html @@ -226,6 +226,8 @@

Usage with Node

Note: Do not use loadLanguages() with Webpack or another bundler, as this will cause Webpack to include all languages and plugins. Use the babel plugin described above.

+

Note: loadLanguages() will ignore unknown languages and log warning messages to the console. You can prevent the warnings by setting loadLanguages.silent = true.

+