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

A newly created selector is rendered but gets a warning "selector does not exist" #93

Closed
Tungstic opened this issue May 11, 2023 · 1 comment · Fixed by #102
Closed
Assignees
Labels
bug Something isn't working

Comments

@Tungstic
Copy link

Tungstic commented May 11, 2023

Describe the bug
A newly created ruleset is rendered on the React page but VS Code gives a warning that that selector does not exist.

To Reproduce
Steps to reproduce the behavior:

  1. Create a React project using create-react-app and add sass. Run the command pnpm start to start the localhost.
  2. Create a CSS module (e.g. "App.module.scss").
  3. Import it into the App.js component for rendering (e.g. "import styles from "./App.module.scss").
  4. Create a new ruleset in App.module.scss.
  5. In App.js, add a className with that newly created selector (e.g. <div className={styles.newSelector}></div>).
  6. Check the rendered page: the element is styled with the newly created rule.
  7. In App.js, a yellow squiggly line appears under the name of the new selector. When hovered over, it says "Selector does not exist".
  8. Try changing focus and going to a different file - the warning remains.
  9. Try pressing Ctrl + Shift + P and choosing Typescript: Restart TS Server - the warning remains.
  10. Ctrl + Shift + P, choose "Reload Window" - the warning disappears.

Expected behavior
After the step 6 above, there shouldn't be a warning from VS Code ("selector does not exist") since the selector exists and is rendered on the page.

Screenshot and video
VSCode 1
css-module-behaviour

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise
  • Version 21H2

Additional context
The problem seems to be linked to Windows. My fellow students who use MacOS haven't encountered the issue, but the others with Windows have. Also, it doesn't always get reproduced: in the GIF I added two selectors before getting the warning on the third one.

@Tungstic Tungstic added the bug Something isn't working label May 11, 2023
@Viijay-Kr
Copy link
Owner

Hi @Tungstic thanks for reporting.

I will need to recheck the support for javascript a bit

So I will try to find some time check this one over the weekend
Thanks for a detailed overview of the bug

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

Successfully merging a pull request may close this issue.

2 participants