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

Style sheet doesn't load on some pages #3357

Open
realhackcraft opened this issue Oct 3, 2024 · 9 comments
Open

Style sheet doesn't load on some pages #3357

realhackcraft opened this issue Oct 3, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@realhackcraft
Copy link

Describe the bug A clear and concise description of what the bug is.
The style tag sometimes has a media="x" attribute, making it not load.

To Reproduce Steps to reproduce the behavior:

  1. Use nextra with bun.
  2. Make a few pages.
  3. Run using next.
  4. See that sometimes, a page has no styles.

Expected behavior A clear and concise description of what you expected to
happen.

Style sheet never has media="x"

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2024-10-02 at 18 04 07
Screenshot 2024-10-02 at 18 04 34

Desktop (please complete the following information):

  • OS: MacOS 15
  • Browser Arc
  • Version latest

More details
I only used turborepo and bun to test, but it shouldn't change the result.

@realhackcraft realhackcraft added the bug Something isn't working label Oct 3, 2024
@dimaMachina
Copy link
Collaborator

Please provide reproduction 🙏

@jimmy-guzman
Copy link

Not sure if this helps but when I see this behavior, deleting the .next folder and re-running seems to fix this. 🤷‍♂️

@realhackcraft
Copy link
Author

Ok, it fixed itself 😵‍💫. However, I think it's still worth it to investigate a bit into why this is happening, as it's quite annoying. I've searched for media="x" in this repo, and it didn't show up. Maybe it's one of the dependencies doing the chaos?

@realhackcraft
Copy link
Author

I thought I had narrowed it down when only refreshing the top level document, "Homepage," was getting rid of the css. When I created a new file called test at the top level though, it stopped happening entirely?

@carlosrsabreu
Copy link

I had a similar problem. To reproduce write on cli pnpm add next react react-dom nextra nextra-theme-blog.

What I did was downgrading Nextra to v2.

@dimaMachina
Copy link
Collaborator

@carlosrsabreu please provide runnable reproduction, if you need help with fixing your issue

manudeli pushed a commit to toss/suspensive that referenced this issue Oct 13, 2024
# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

I address an issue where undefined locale URLs defaulted to 'en' in
Nextra documentation. I've implemented Nextra's middleware to recognize
locale cookies.


https://github.com/user-attachments/assets/03a068df-feef-47f4-b505-532fb29da329

### [AS-IS]
- Custom middleware redirecting undefined locales to '/en'

### [TO-BE]
- Use Nextra's built-in middleware
- Exclude 'img' directory in matcher configuration
- Prevents unnecessary middleware processing for image files, aligning
with Nextra's example configuration (see [Nextra PR
#3439](https://github.com/shuding/nextra/pull/3439/files#diff-e986406290c383f5b481ce7bc0136f142b96083e0807190d530561eea83bfc70R5-R7)
`icon.svg`)


### Issue

Nextra styles may appear broken in development. See [Issue
#3357](shuding/nextra#3357). Could you please
confirm if you're experiencing this as well?


<img width="1797" alt="스크린샷 2024-10-13 오후 8 26 02"
src="https://github.com/user-attachments/assets/88dd507a-81ab-4312-abce-feea2a714495">




## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
@dimaMachina
Copy link
Collaborator

dimaMachina commented Oct 17, 2024

For anyone having this issue here is a fix #3461 (comment) by @87xie

Docs were updated to require _app.jsx because I had problems in Next.js 15 rc1 without it I couldn't build app

https://nextra.site/docs/docs-theme/start#create-nextjs-app-component
https://nextra.site/docs/blog-theme/start#create-nextjs-app-component

@kangju2000
Copy link

@dimaMachina

I've encountered this issue as well. In the development environment, I see the following screen. It seems to occur randomly on either /ko or /en routes.

image

To reproduce in the development environment:

  1. Clone the suspensive repository
  2. Run pnpm install
  3. Execute pnpm build
  4. Start the dev server with pnpm --filter=suspensive.org dev

I've checked this comment, but it wasn't a viable solution in my case as I'm already using _app.tsx.

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

No branches or pull requests

6 participants
@dimaMachina @carlosrsabreu @kangju2000 @jimmy-guzman @realhackcraft and others