Skip to content

Commit 8e77c17

Browse files
committed
add packageAlias
fixes webpack#151
1 parent b7cd807 commit 8e77c17

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎lib/WebpackOptionsApply.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
241241
compiler.applyPlugins("after-plugins", compiler);
242242
compiler.resolvers.normal.apply(
243243
new UnsafeCachePlugin(options.resolve.unsafeCache),
244+
options.resolve.packageAlias ? new DirectoryDescriptionFileFieldAliasPlugin("package.json", options.resolve.packageAlias) : function() {},
244245
new ModuleAliasPlugin(options.resolve.alias),
245246
makeRootPlugin("module", options.resolve.root),
246247
new ModulesInDirectoriesPlugin("module", options.resolve.modulesDirectories),

‎lib/WebpackOptionsDefaulter.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function WebpackOptionsDefaulter() {
5050
this.set("resolve.packageMains", ["webpack", "browser", "web", "browserify", ["jam", "main"], "main"]);
5151
this.set("resolveLoader.packageMains", ["webpackLoader", "webLoader", "loader", "main"]);
5252

53+
this.set("resolve.packageAlias", false);
54+
5355
this.set("optimize.occurenceOrderPreferEntry", true);
5456
}
5557
module.exports = WebpackOptionsDefaulter;

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"optimist": "0.6.x",
1010
"uglify-js": "2.4.x",
1111
"async": "0.2.x",
12-
"enhanced-resolve": "0.6.x",
12+
"enhanced-resolve": "0.7.x",
1313
"clone": "0.1.x",
1414
"webpack-core": "0.3.x",
1515
"node-libs-browser": "0.1.x",

0 commit comments

Comments
 (0)