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
Next is not recognizing _document.tsx file #28786
Comments
Can confirm, even I am having the same issue |
This also happens with global styles & |
Confirming the same issue |
This is a issue with eslint config that nextjs 11.1.2 uses. eslint-config-next 11.1.2 causes this issue. Try downgrading that or use the canary version of the plugin. |
The latest canary version of the plugin ( The ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
}); The squiggly red line in VSCode comes for this part |
Or you can convert it accordingly to a named function: ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) =>
function EnhancedApp(props) {
return sheets.collect(<App {...props} />)
},
}) This is not a Next.js-specific problem per se, I see you are using Material UI. https://github.com/mui-org/material-ui/blob/master/examples/nextjs/pages/_document.js#L58 They should be probably made aware of this. Either adding a an ESLint ignore on their example above that line or at least comment on it. |
Thanks a lot for this! |
This PR should fix it, but it has not been released yet |
This fix did not work for me, I just get page building errors instead: Also @omBratteng that PR is merged and all my packages are up to date but my issue still persists. Edit* I missed the note about downgrading I am curious to know when I can upgrade without having problems again though. Cheers! |
@tr1s if you install |
I actually just tested out updating |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.1.2
What version of Node.js are you using?
14.17.1
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next start
Describe the Bug
Here's my
_document.tsx
fileEverything was working fine till I upgraded Next from 11.1.0 to 11.1.2
Now, build error comes stating the following:
What's the problem here? It is in the
pages
folder and everything was working fine. Now, even if I go back to 11.1.0, the error still comes!!Expected Behavior
There should be no error as the file is correctly placed with content also correctly written
To Reproduce
Create a custom
_document.tsx
file in a typescript next project and try to build the project.The text was updated successfully, but these errors were encountered: