Skip to content

Commit

Permalink
Ignore context in resolve caching when resolve or resolveLoader plugi…
Browse files Browse the repository at this point in the history
…ns are provided.
  • Loading branch information
mikesherov committed Jun 28, 2017
1 parent a959fef commit bdddee2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/WebpackOptionsDefaulter.js
Expand Up @@ -98,11 +98,17 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
else
return ["module", "main"];
});
this.set("resolve.cacheWithContext", "make", (options) => {
return Array.isArray(options.resolve.plugins) && options.resolve.plugins.length > 0;
});
this.set("resolveLoader", {});
this.set("resolveLoader.unsafeCache", true);
this.set("resolveLoader.mainFields", ["loader", "main"]);
this.set("resolveLoader.extensions", [".js", ".json"]);
this.set("resolveLoader.mainFiles", ["index"]);
this.set("resolveLoader.cacheWithContext", "make", (options) => {
return Array.isArray(options.resolveLoader.plugins) && options.resolveLoader.plugins.length > 0;
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -9,7 +9,7 @@
"ajv": "^5.1.5",
"ajv-keywords": "^2.0.0",
"async": "^2.1.2",
"enhanced-resolve": "^3.0.0",
"enhanced-resolve": "mikesherov/enhanced-resolve#b03799b6f06f82423e0a5c57fcc196b8eaeb8c07",
"escope": "^3.6.0",
"interpret": "^1.0.0",
"json-loader": "^0.5.4",
Expand Down
3 changes: 3 additions & 0 deletions schemas/webpackOptionsSchema.json
Expand Up @@ -483,6 +483,9 @@
"cachePredicate": {
"instanceof": "Function"
},
"cacheWithContext": {
"type": "boolean"
},
"descriptionFiles": {
"$ref": "#/definitions/common.arrayOfStringValues"
},
Expand Down

0 comments on commit bdddee2

Please sign in to comment.