-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
feat: add fallback if custom getLocalIdent returns null #1193
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,11 +283,32 @@ function getModulesPlugins(options, loaderContext) { | |
extractImports(), | ||
modulesScope({ | ||
generateScopedName(exportName) { | ||
return getLocalIdent(loaderContext, localIdentName, exportName, { | ||
context: localIdentContext, | ||
hashPrefix: localIdentHashPrefix, | ||
regExp: localIdentRegExp, | ||
}); | ||
let localIdent = getLocalIdent( | ||
loaderContext, | ||
localIdentName, | ||
exportName, | ||
{ | ||
context: localIdentContext, | ||
hashPrefix: localIdentHashPrefix, | ||
regExp: localIdentRegExp, | ||
} | ||
); | ||
|
||
// A null/undefined value signals that we should invoke the default | ||
// getLocalIdent method. | ||
if (localIdent == null && getLocalIdent !== defaultGetLocalIdent) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the situation where there wasn't a custom There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is bad logic, we don't need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, at line 140 in the That may never happen, as there may already be safeguards in place to keep that from happening - and even if it did run the same function twice, it probably wouldn't be a big deal - so that check can be removed. |
||
localIdent = defaultGetLocalIdent( | ||
loaderContext, | ||
localIdentName, | ||
exportName, | ||
{ | ||
context: localIdentContext, | ||
hashPrefix: localIdentHashPrefix, | ||
regExp: localIdentRegExp, | ||
} | ||
); | ||
} | ||
return localIdent; | ||
}, | ||
exportGlobals: options.modules.exportGlobals, | ||
}), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.some-class { | ||
color: red; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.some-class { | ||
color: red; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import css1 from './issue-1191.css'; | ||
import css2 from './issue-1191-custom.css'; | ||
|
||
const wrapper = { css1, css2 } | ||
|
||
__export__ = wrapper; | ||
|
||
export default wrapper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallback
😄