Get rid of typeof for checking undefined
This commit is contained in:
parent
a02bf9960d
commit
efa69cd628
|
@ -60,13 +60,13 @@ class ContextReplacementPlugin {
|
|||
cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => {
|
||||
if (!result) return;
|
||||
if (resourceRegExp.test(result.request)) {
|
||||
if (typeof newContentResource !== "undefined") {
|
||||
if (newContentResource !== undefined) {
|
||||
result.request = newContentResource;
|
||||
}
|
||||
if (typeof newContentRecursive !== "undefined") {
|
||||
if (newContentRecursive !== undefined) {
|
||||
result.recursive = newContentRecursive;
|
||||
}
|
||||
if (typeof newContentRegExp !== "undefined") {
|
||||
if (newContentRegExp !== undefined) {
|
||||
result.regExp = newContentRegExp;
|
||||
}
|
||||
if (typeof newContentCallback === "function") {
|
||||
|
@ -82,13 +82,13 @@ class ContextReplacementPlugin {
|
|||
cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => {
|
||||
if (!result) return;
|
||||
if (resourceRegExp.test(result.resource)) {
|
||||
if (typeof newContentResource !== "undefined") {
|
||||
if (newContentResource !== undefined) {
|
||||
result.resource = path.resolve(result.resource, newContentResource);
|
||||
}
|
||||
if (typeof newContentRecursive !== "undefined") {
|
||||
if (newContentRecursive !== undefined) {
|
||||
result.recursive = newContentRecursive;
|
||||
}
|
||||
if (typeof newContentRegExp !== "undefined") {
|
||||
if (newContentRegExp !== undefined) {
|
||||
result.regExp = newContentRegExp;
|
||||
}
|
||||
if (typeof newContentCreateContextMap === "function") {
|
||||
|
|
Loading…
Reference in New Issue