changes some defaults for modules

This commit is contained in:
Tobias Koppers 2012-11-06 15:05:52 +01:00
parent 0366444379
commit 3b881ba414
2 changed files with 10 additions and 9 deletions

View File

@ -439,6 +439,7 @@ You can also save this options object in a JSON file and use it with the shell c
resolve: {
// options for resolving
// see https://github.com/webpack/enhanced-resolve for more
paths: ["/my/absolute/dirname"],
// 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
// postfixes for files to try
packageMains: ["abc", "main"]
// defaults: ["webpack", "browserify", "main"]
// defaults: ["webpack", "browserify", "web", "main"]
// lookup fields in package.json
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
// postfixes for loader modules to try
loaderPackageMains: ["loader", "main"]
// defaults: ["webpackLoader", "loader", "webpack", "main"]
// defaults: ["webpackLoader", "webLoader", "loader", "main"]
// lookup fields for loaders in package.json
loaders: [{
@ -488,11 +489,11 @@ You can also save this options object in a JSON file and use it with the shell c
loader: "val"
}],
// default: (defaults are also included if you define your own)
// [{test: /\.coffee$/, loader: "coffee"},
// {test: /\.json$/, loader: "json"},
// {test: /\.jade$/, loader: "jade"},
// {test: /\.css$/, loader: "style!css"},
// {test: /\.less$/, loader: "style!css!val!less"}]
// [{test: "\\\\.coffee$", loader: "coffee"},
// {test: "\\\\.json$", loader: "json"},
// {test: "\\\\.jade$", loader: "jade"},
// {test: "\\\\.css$", loader: "style!css"},
// {test: "\\\\.less$", loader: "style!css!val/separable?cacheable!less"}]
// automatically use loaders if filename match RegExp
// and no loader is specified.
// you can pass a RegExp as string, or multiple RegExps/strings in an array

View File

@ -107,13 +107,13 @@ module.exports = function webpackMain(context, moduleName, options, callback) {
if(!options.resolve.postfixes)
options.resolve.postfixes = ["", "-webpack", "-web"];
if(!options.resolve.packageMains)
options.resolve.packageMains = ["webpack", "browserify", "main"];
options.resolve.packageMains = ["webpack", "browserify", "web", "main"];
if(!options.resolve.loaderExtensions)
options.resolve.loaderExtensions = [".webpack-web-loader.js", ".webpack-loader.js", ".web-loader.js", ".loader.js", "", ".js"];
if(!options.resolve.loaderPostfixes)
options.resolve.loaderPostfixes = ["-webpack-web-loader", "-webpack-loader", "-web-loader", "-loader", ""];
if(!options.resolve.loaderPackageMains)
options.resolve.loaderPackageMains = ["webpackLoader", "loader", "webpack", "main"];
options.resolve.loaderPackageMains = ["webpackLoader", "webLoader", "loader", "main"];
if(!options.resolve.modulesDirectories)
options.resolve.modulesDirectories = ["web_modules", "node_modules"];
if(!options.resolve.alias)