You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The instructions in Step 3: Add Head Meta (Example) of the README suggest adding the various meta and link tags to a custom Document component (_document.js / _document.tsx), including the viewport meta tag. The examples also follow these instructions by having the viewport meta tag in custom _document.js.
This will however result in the following warning being raised by the latest version of Next.js:
Warning: viewport meta tags should not be used in _document.js's <Head>. https://err.sh/next.js/no-document-viewport-meta
Following the link provided in the warning gives further details, specifically it advises:
Adding <meta name="viewport" ...> in pages/_document.js will lead to unexpected results since it cannot be deduped. The viewport tag should be handled by next/head in pages/_app.js.
I should make it clear that this is therefore not an issue with next-pwa, just an issue with where the next-pwa documentation says we should place the viewport meta tag. As such my steps to reproduce and my reproduce setup repo will exclude next-pwa in the setup altogether.
How To Reproduce
Steps to reproduce the behavior:
Setup a minimal Next.js app: yarn create next-app
Create a pages/_document.js file and add the following code to it:
So next-pwa's README and examples need to be updated accordingly. I'm deep in code at the moment with a couple projects so if someone else is willing to create a PR that would be great. If I get some free time and one hasn't been made yet then I would see if I can make one.
The text was updated successfully, but these errors were encountered:
Summary
The instructions in Step 3: Add Head Meta (Example) of the README suggest adding the various
meta
andlink
tags to a customDocument
component (_document.js
/_document.tsx
), including the viewport meta tag. The examples also follow these instructions by having the viewport meta tag in custom _document.js.This will however result in the following warning being raised by the latest version of Next.js:
Following the link provided in the warning gives further details, specifically it advises:
I should make it clear that this is therefore not an issue with
next-pwa
, just an issue with where the next-pwa documentation says we should place the viewport meta tag. As such my steps to reproduce and my reproduce setup repo will exclude next-pwa in the setup altogether.How To Reproduce
Steps to reproduce the behavior:
yarn create next-app
pages/_document.js
file and add the following code to it:yarn dev
http://localhost:3000
in your browserLink to minimal reproduce setup repository if any: https://github.com/owanhunte/next-pwa-viewport-meta
Expected Behaviors
No warning should have been generated if the suggested placement of the viewport meta tag was compatible with the Next.js environment.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Context
The page linked to in the warning states how to fix the warning. Simply set your viewport
meta
tag inpages/_app.js
instead, like so:So
next-pwa
's README and examples need to be updated accordingly. I'm deep in code at the moment with a couple projects so if someone else is willing to create a PR that would be great. If I get some free time and one hasn't been made yet then I would see if I can make one.The text was updated successfully, but these errors were encountered: