nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.8k stars 2.38k forks source link

getCSSModuleLocalIdent generates hash which allow unacceptable symbols for selector (eg. +) #20113

Open More4ever opened 1 year ago

More4ever commented 1 year ago

Current Behavior

Css modules generated class names contain + symbol after generation

as result document.querySelectorAll throw an error: SyntaxError Failed to execute 'querySelectorAll' on 'Document': '.classPrefix__4Q-A+' is not a valid selector.

Expected Behavior

css modules logic should generate class names acceptable as selectors: a-zA-Z0-9-_

GitHub Repo

No response

Steps to Reproduce

It is pretty hard to reproduce, but it is bunch of similar issues:

Nx Report

Node   : 18.15.0
   OS     : darwin-x64
   yarn   : 1.22.17

   nx                 : 16.5.2
   @nx/js             : 16.5.2
   @nx/jest           : 16.5.2
   @nx/linter         : 16.5.2
   @nx/workspace      : 16.5.2
   @nx/cypress        : 16.5.2
   @nx/devkit         : 16.5.2
   @nx/eslint-plugin  : 16.5.2
   @nx/react          : 16.5.2
   @nrwl/tao          : 16.5.2
   @nx/web            : 16.5.2
   @nx/webpack        : 16.5.2
   nx-cloud           : 16.1.0
   typescript         : 5.1.6

Failure Logs

No response

Package Manager Version

1.22.17

Operating System

Additional Information

Fix used inside CRA for same issue: https://github.com/facebook/create-react-app/pull/12013/files#diff-fc4e5bb939a929b32c42671c5deb2c00260422789fc33a0b96668d737fe44a82R33

Link to source code with issue: https://github.com/nrwl/nx/blob/master/packages/webpack/src/utils/get-css-module-local-ident.ts#L20

github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏