Skip to content

Commit 3b881ba

Browse files
committed
changes some defaults for modules
1 parent 0366444 commit 3b881ba

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ You can also save this options object in a JSON file and use it with the shell c
439439

440440
resolve: {
441441
// options for resolving
442+
// see https://github.com/webpack/enhanced-resolve for more
442443

443444
paths: ["/my/absolute/dirname"],
444445
// default: (defaults are also included if you define your own)
@@ -463,7 +464,7 @@ You can also save this options object in a JSON file and use it with the shell c
463464
// postfixes for files to try
464465

465466
packageMains: ["abc", "main"]
466-
// defaults: ["webpack", "browserify", "main"]
467+
// defaults: ["webpack", "browserify", "web", "main"]
467468
// lookup fields in package.json
468469

469470
loaderExtensions: [".loader.js", ".www-loader.js", "", ".js"],
@@ -479,7 +480,7 @@ You can also save this options object in a JSON file and use it with the shell c
479480
// postfixes for loader modules to try
480481

481482
loaderPackageMains: ["loader", "main"]
482-
// defaults: ["webpackLoader", "loader", "webpack", "main"]
483+
// defaults: ["webpackLoader", "webLoader", "loader", "main"]
483484
// lookup fields for loaders in package.json
484485

485486
loaders: [{
@@ -488,11 +489,11 @@ You can also save this options object in a JSON file and use it with the shell c
488489
loader: "val"
489490
}],
490491
// default: (defaults are also included if you define your own)
491-
// [{test: /\.coffee$/, loader: "coffee"},
492-
// {test: /\.json$/, loader: "json"},
493-
// {test: /\.jade$/, loader: "jade"},
494-
// {test: /\.css$/, loader: "style!css"},
495-
// {test: /\.less$/, loader: "style!css!val!less"}]
492+
// [{test: "\\\\.coffee$", loader: "coffee"},
493+
// {test: "\\\\.json$", loader: "json"},
494+
// {test: "\\\\.jade$", loader: "jade"},
495+
// {test: "\\\\.css$", loader: "style!css"},
496+
// {test: "\\\\.less$", loader: "style!css!val/separable?cacheable!less"}]
496497
// automatically use loaders if filename match RegExp
497498
// and no loader is specified.
498499
// you can pass a RegExp as string, or multiple RegExps/strings in an array

lib/webpack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ module.exports = function webpackMain(context, moduleName, options, callback) {
107107
if(!options.resolve.postfixes)
108108
options.resolve.postfixes = ["", "-webpack", "-web"];
109109
if(!options.resolve.packageMains)
110-
options.resolve.packageMains = ["webpack", "browserify", "main"];
110+
options.resolve.packageMains = ["webpack", "browserify", "web", "main"];
111111
if(!options.resolve.loaderExtensions)
112112
options.resolve.loaderExtensions = [".webpack-web-loader.js", ".webpack-loader.js", ".web-loader.js", ".loader.js", "", ".js"];
113113
if(!options.resolve.loaderPostfixes)
114114
options.resolve.loaderPostfixes = ["-webpack-web-loader", "-webpack-loader", "-web-loader", "-loader", ""];
115115
if(!options.resolve.loaderPackageMains)
116-
options.resolve.loaderPackageMains = ["webpackLoader", "loader", "webpack", "main"];
116+
options.resolve.loaderPackageMains = ["webpackLoader", "webLoader", "loader", "main"];
117117
if(!options.resolve.modulesDirectories)
118118
options.resolve.modulesDirectories = ["web_modules", "node_modules"];
119119
if(!options.resolve.alias)

0 commit comments

Comments
 (0)