diff --git a/.eslintrc b/.eslintrc index 89afc764..29cb19d2 100644 --- a/.eslintrc +++ b/.eslintrc @@ -19,6 +19,9 @@ "react/jsx-filename-extension": 0, "react/prefer-stateless-function": 0, "no-restricted-syntax": 0, - "no-eval": 0 + "no-eval": 0, + "no-console": ["error", { + "allow": ["warn", "error"] + }] } } \ No newline at end of file diff --git a/src/hocs/app-with-translation.js b/src/hocs/app-with-translation.js index 4348d152..902c3bf7 100644 --- a/src/hocs/app-with-translation.js +++ b/src/hocs/app-with-translation.js @@ -67,9 +67,11 @@ export default function (WrappedComponent) { } // Step 2: Determine namespace dependencies - let namespacesRequired = config.allLanguages + let namespacesRequired = config.ns if (Array.isArray(pageProps.namespacesRequired)) { ({ namespacesRequired } = pageProps) + } else if (process.env.NODE_ENV !== 'production') { + console.warn(`You have not declared a namespacesRequired array on your page-level component: ${Component.displayName}. This will cause all namespaces to be sent down to the client, possibly negatively impacting the performance of your app. For more info, see: https://github.com/isaachinman/next-i18next#4-declaring-namespace-dependencies`) } // Step 3: Perform data fetching, depending on environment