-
-
Notifications
You must be signed in to change notification settings - Fork 609
Inherit getLocalIdent from parent loader #583
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
Conversation
(not sure what's wrong with AppVeyor) |
Codecov Report
@@ Coverage Diff @@
## master #583 +/- ##
==========================================
- Coverage 98.63% 97.31% -1.32%
==========================================
Files 10 10
Lines 367 373 +6
Branches 87 89 +2
==========================================
+ Hits 362 363 +1
- Misses 5 10 +5
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #583 +/- ##
==========================================
- Coverage 98.63% 97.31% -1.32%
==========================================
Files 10 10
Lines 367 373 +6
Branches 87 89 +2
==========================================
+ Hits 362 363 +1
- Misses 5 10 +5
Continue to review full report at Codecov.
|
Could you try with webpack.config.js {
loader: 'css-loader'
options: {
ident: 'css', // <= this line, which value isn't important
getLocalIdent: () => {}
}
} This should prevent losing the reference to In case it doesn't work |
The `ident` option does indeed work! I didn't try it because I saw it was fixed (guess not anymore). Also good to know that `_module` is deprecated. :)
|
What kind of change does this PR introduce?
Bug fix.
Did you add tests for your changes?
No. (I couldn't figure out how to compose from a css file with the test helpers)
Summary
Someone using one of my libraries ran into an issue where getLocalIdent was not being applied to composed classes. (odensc/css-loader-minify-class#1)
Looking into the source code for css-loader, I found that the loader query is stringified sometimes - which causes it to lose the function reference to
getLocalIdent
. This PR fixes that by inheriting the getLocalIdent function from the parent loader if possible.Also fixes #524 which was reported on this repo.
Does this PR introduce a breaking change?
No.