Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Linter Issue - @next/next/no-document-import-in-page #145

Closed
grez96 opened this issue Sep 23, 2021 · 2 comments · Fixed by #151
Closed

[Bug] Linter Issue - @next/next/no-document-import-in-page #145

grez96 opened this issue Sep 23, 2021 · 2 comments · Fixed by #151
Assignees
Labels
bug Something isn't working

Comments

@grez96
Copy link
Contributor

grez96 commented Sep 23, 2021

npm run linters

generates the following error:
image
Error: next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.

Seems to happen because nextjs expects _document file to end with a .js extension, but in reality it ends with a .tsx extension

@grez96 grez96 added the bug Something isn't working label Sep 23, 2021
@grez96 grez96 assigned iranreyes and grez96 and unassigned iranreyes Sep 23, 2021
@DonghyukJacobJang
Copy link
Collaborator

vercel/next.js#28596

@fzhang13 fzhang13 assigned fzhang13 and unassigned grez96 Sep 28, 2021
@fzhang13 fzhang13 linked a pull request Sep 28, 2021 that will close this issue
13 tasks
@AaronLayton
Copy link

Just dropping a note to say still an issue and replicable with "eslint-config-next": "^11.1.2", on Windows

Temporarily adding the ignore line

{
  "extends": ["next", "next/core-web-vitals"],
  "rules": {
    "@next/next/no-document-import-in-page": "off"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants