webpack/lib/WebpackOptionsDefaulter.js

56 lines
1.9 KiB
JavaScript
Raw Normal View History

2013-01-31 01:49:25 +08:00
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
2013-02-15 21:16:18 +08:00
var OptionsDefaulter = require("webpack-core/lib/OptionsDefaulter");
2013-01-31 01:49:25 +08:00
2013-02-15 21:16:18 +08:00
function WebpackOptionsDefaulter() {
2013-01-31 01:49:25 +08:00
OptionsDefaulter.call(this);
this.set("debug", false);
this.set("devtool", false);
2013-01-31 01:49:25 +08:00
this.set("context", process.cwd());
this.set("target", "web");
2013-01-31 01:49:25 +08:00
this.set("output", {});
this.set("node", {});
2013-01-31 01:49:25 +08:00
this.set("optimize", {});
this.set("resolve", {});
this.set("resolveLoader", {});
2013-01-31 01:49:25 +08:00
this.set("output.libraryTarget", "var");
this.set("output.path", "");
2013-03-26 23:54:41 +08:00
this.set("output.sourceMapFilename", "[file].map");
2013-05-21 17:08:08 +08:00
this.set("output.hashFunction", "md5");
this.set("output.hashDigest", "hex");
this.set("output.hashDigestLength", 20);
2013-01-31 01:49:25 +08:00
this.set("node.console", false);
this.set("node.process", true);
this.set("node.global", true);
2013-03-01 21:59:38 +08:00
this.set("node.buffer", true);
this.set("node.__filename", "mock");
this.set("node.__dirname", "mock");
this.set("resolve.fastUnsafe", []);
this.set("resolveLoader.fastUnsafe", []);
2013-01-31 01:49:25 +08:00
this.set("resolve.modulesDirectories", ["web_modules", "node_modules"]);
this.set("resolveLoader.modulesDirectories", ["web_loaders", "web_modules", "node_loaders", "node_modules"]);
this.set("resolveLoader.moduleTemplates", ["*-webpack-loader", "*-web-loader", "*-loader", "*"]);
this.set("resolve.alias", {});
this.set("resolveLoader.alias", {});
2013-01-31 01:49:25 +08:00
this.set("resolve.extensions", ["", ".webpack.js", ".web.js", ".js"]);
this.set("resolveLoader.extensions", ["", ".webpack-loader.js", ".web-loader.js", ".loader.js", ".js"]);
2013-10-13 04:08:04 +08:00
this.set("resolve.packageMains", ["webpack", "browser", "web", "browserify", ["jam", "main"], "main"]);
2013-02-13 22:01:12 +08:00
this.set("resolveLoader.packageMains", ["webpackLoader", "webLoader", "loader", "main"]);
2013-05-08 19:28:54 +08:00
this.set("optimize.occurenceOrderPreferEntry", true);
2013-01-31 01:49:25 +08:00
}
module.exports = WebpackOptionsDefaulter;
WebpackOptionsDefaulter.prototype = Object.create(OptionsDefaulter.prototype);