webpack/lib/WebpackOptionsDefaulter.js

53 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

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