WRQ-200: Apply own hash on css-module-ident.js #131
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
Issue Resolved / Feature Added
-Cause: When generating css, react-dev-utils generates hash.
However, when creating a hash,
+
is not excluded.This may cause unexpected behavior when using moduled CSS class names in querySelector.
Other developers also had the same problem, so they requested a react-dev-utils PR as shown below, but it has not been merged for over a year, so it is difficult to expect anything.
-Solution: We had previously implemented a getLocalIdent in @enact/dev-utils that does not add a hash, called

getSimpleCSSModuleLocalIdent
, for internal development.We can solve this issue by stopping using react-dev-utils and adding an option to @enact/dev-utils to add hashes without
+
.Using
base62
for generating hashes.base64 is base62 with
+(62nd)
and/(63rd)
added.In other words, the cause of the problem (
+
) does not exist in base62.Of course, it is provided in loader-utils.
( https://github.com/webpack/loader-utils/blob/50890cd3b8592a6785306b17b82b5f31449561ef/README.md?plain=1#L79 )
Resolution
Apply own hash on css-module-ident.js
(this code is from webpack/loader-utils)
Additional Considerations
SIMPLE_CSS_IDENT
statement from cli to dev-utils. (check WRQ-200: Remove getCSSModuleLocalIdent and use cssModuleIdent only cli#336)Previously,
SIMPLE_CSS_IDENT
was checked in the cli to determine whether to use react-dev-utils (hash generation) or @enact/dev-utils (not hash generation).However, starting from this PR, react-dev-utils has been removed and integrated into @enact/dev-utils, so the
SIMPLE_CSS_IDENT
check is moved inside @enact/dev-utils.Other than that, there is no difference in operation (similar to before, check
SIMPLE_CSS_IDENT
and decide whether to generate a hash or not.)Links
WRQ-200
Comments
Enact-DCO-1.0-Signed-off-by: Taeyoung Hong ([email protected])