codesandbox / codesandbox/codesandbox-client
Styles aren't correctly attached to elements when using Create React App + CSS modules
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.6k
- Forks
- 2.4k
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 2
Description
🐛 bug report
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project
adheres to. - I have searched the issue tracker for an issue that matches the one I want
to file, without success.
Description of the problem
If a CSS module className is added to an element before that className exists in the relevant CSS module file, CodeSandbox does not pick it up.
How has this issue affected you? What are you trying to accomplish?
This makes using CSS modules very difficult. It is possible to get CodeSandbox to pick up the styles again by changing the className on the element, saving, and then changing it back to the one you want
To Reproduce
- Fork the sandbox at https://codesandbox.io/s/happy-hypatia-0fgip
- After it has been forked, uncomment the code in
App.module.scss - Expect that "Hello CodeSandbox" turns green.
Link to sandbox: link (optional)
Your Environment
| Software | Name/Version |
|---|---|
| Сodesandbox | codesandbox.io |
| Browser | Chrome |
| Operating System | MacOS |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Fork the linked sandbox and reproduce the issue by uncommenting the code in App.module.scss after the fork. Trace how the CSS module className is attached to the element; done means the “Hello CodeSandbox” text turns green without changing the className to trigger an update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, scss
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100