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

Styles file not get packed when astro build in SSG mode for react component wrapped with context #8807

Open
1 task
ace-han opened this issue Oct 11, 2023 · 4 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: styling Related to styles (scope) pkg: react Related to React (scope)

Comments

@ace-han
Copy link

ace-han commented Oct 11, 2023

Astro Info

Astro                    v3.2.4
Node                     v18.18.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

As shown below, everything is fine when doing astro dev.
However, astro build and astro preview I found count: 0 not styled with a red background color.

With a little digging, it was due to global.css not effective in react component which was wrapped with React.Context

Here is a minimal reproducible link

https://stackblitz.com/edit/withastro-astro-lvshyf?file=src%2Fstyles%2Fglobal.css,src%2Fcomponents%2FMathExam.tsx

image

What's the expected result?

I want a consistency behavior with astro dev and astro build as in count: 0 with background color: red after astro build

image

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-lvshyf?file=src%2Fstyles%2Fglobal.css,src%2Fcomponents%2FMathExam.tsx

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Oct 11, 2023
@DevRohit06
Copy link

you can use style tag in index.astro

image

@ace-han
Copy link
Author

ace-han commented Oct 17, 2023

you can use style tag in index.astro

image

@DevRohit06 It was just a minimal reproducible scenario.

In simple case, I could do a global import or sth like what you have mentioned.

In fact, my website has many ui library dependencies, some are importing style files deeply down inside their code .

It's difficult to identify which one is importing style files within React.Context.

I think this behavior should be a solid bug

@bluwy bluwy added - P4: important Violate documented behavior or significantly impacts performance (priority) and removed needs triage Issue needs to be triaged labels Oct 17, 2023
@bluwy bluwy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed - P4: important Violate documented behavior or significantly impacts performance (priority) labels Mar 18, 2024
@bluwy
Copy link
Member

bluwy commented Mar 18, 2024

Marking as p3 for now as this doesn't seem to be affecting as much users as expected. But we'll be sure to follow-up as soon as possible.

@ascorbic
Copy link
Contributor

ascorbic commented Jan 3, 2025

Confirmed this is still present in 5.1.2

@bluwy bluwy added feat: styling Related to styles (scope) pkg: react Related to React (scope) labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: styling Related to styles (scope) pkg: react Related to React (scope)
Projects
None yet
Development

No branches or pull requests

4 participants