specify lookup fields in package.json

This commit is contained in:
Tobias Koppers 2012-10-27 02:16:42 +02:00
parent 7861570822
commit 7f1fc5b825
3 changed files with 14 additions and 2 deletions

View File

@ -463,6 +463,10 @@ You can also save this options object in a JSON file and use it with the shell c
// ["", ".webpack.js", ".web.js", ".js"]
// postfixes for files to try
packageMains: ["abc", "main"]
// defaults: ["webpack", "browserify", "main"]
// lookup fields in package.json
loaderExtensions: [".loader.js", ".www-loader.js", "", ".js"],
// defaults: (defaults are NOT included if you define your own)
// [".webpack-web-loader.js", ".webpack-loader.js",
@ -475,6 +479,10 @@ You can also save this options object in a JSON file and use it with the shell c
// "-web-loader", "-loader", ""]
// postfixes for loader modules to try
loaderPackageMains: ["loader", "main"]
// defaults: ["webpackLoader", "loader", "webpack", "main"]
// lookup fields for loaders in package.json
loaders: [{
test: /\.generator\.js/,
exclude: /\.no\.generator\.js/,

View File

@ -106,10 +106,14 @@ module.exports = function webpackMain(context, moduleName, options, callback) {
options.resolve.extensions = ["", ".webpack.js", ".web.js", ".js"];
if(!options.resolve.postfixes)
options.resolve.postfixes = ["", "-webpack", "-web"];
if(!options.resolve.packageMains)
options.resolve.packageMains = ["webpack", "browserify", "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"];
if(!options.resolve.modulesDirectorys)
options.resolve.modulesDirectorys = ["web_modules", "jam", "node_modules"];
if(!options.resolve.alias)

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "0.7.9",
"version": "0.7.10",
"author": "Tobias Koppers @sokra",
"description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.",
"dependencies": {
@ -9,7 +9,7 @@
"uglify-js": "1.2.x",
"sprintf": "0.1.x",
"enhanced-require": "0.3.x",
"enhanced-resolve": "0.2.x",
"enhanced-resolve": "0.3.x",
"raw-loader": "0.2.x",
"json-loader": "0.2.x",
"jade-loader": "0.2.x",