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

CSS modules not working in /app/not-found.tsx #48133

Closed
1 task done
nghiepdev opened this issue Apr 8, 2023 · 3 comments · Fixed by #49155
Closed
1 task done

CSS modules not working in /app/not-found.tsx #48133

nghiepdev opened this issue Apr 8, 2023 · 3 comments · Fixed by #49155
Labels
bug Issue was opened via the bug report template.

Comments

@nghiepdev
Copy link
Contributor

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #22 SMP Tue Jan 10 18:39:00 UTC 2023
    Binaries:
      Node: 16.17.0
      npm: 8.15.0
      Yarn: 1.22.19
      pnpm: 7.1.0
    Relevant packages:
      next: 13.3.0
      eslint-config-next: 13.2.4
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/dark-microservice-lxq1q8?file=%2Fapp%2Fnot-found.tsx

To Reproduce

Click to Go to 404 page.

Describe the Bug

CSS modules do not apply in not-found.tsx

Expected Behavior

CSS modules just work

Which browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

next dev

@nghiepdev nghiepdev added the bug Issue was opened via the bug report template. label Apr 8, 2023
@jinojacob15
Copy link

jinojacob15 commented Apr 10, 2023

Me also had the same experience , the new 'not-found.js' file is full of bugs , link is broken , css modules being not loaded .
seems like connected with this bug #48073

@schardev
Copy link

schardev commented Apr 14, 2023

Can confirm this as well. Importing the *.module.scss in not-found.tsx itself works but the styles aren't being compiled.

Edit: I sorta worked around it by using a separate route for 404 and redirecting all the "not found" throws to it.

@kodiakhq kodiakhq bot closed this as completed in #49155 May 3, 2023
kodiakhq bot pushed a commit that referenced this issue May 3, 2023
When using the `not-found.js` file to match missed routes, `serverCSSForEntries` will always be empty as the `ComponentMod.pages` itself doesn't contain any actual entry. We need to handle that as a special case.

Closes #48133.
@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants