diff --git a/examples/with-apollo/lib/apollo.js b/examples/with-apollo/lib/apollo.js index 766dd8ee8949794..58cdf83d1b7e3d5 100644 --- a/examples/with-apollo/lib/apollo.js +++ b/examples/with-apollo/lib/apollo.js @@ -40,6 +40,15 @@ export function withApollo(PageComponent, { ssr = true } = {}) { const { AppTree } = ctx const inAppContext = Boolean(ctx.ctx) + if (process.env.NODE_ENV === 'development') { + if (inAppContext) { + console.warn( + 'Warning: You have opted-out of Automatic Static Optimization due to `withApollo` in `pages/_app`.\n' + + 'Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n' + ) + } + } + if (ctx.apolloClient) { throw new Error('Multiple instances of withApollo found.') }