better config file check, added hook for VariableDeclarators

This commit is contained in:
Tobias Koppers 2013-02-22 17:01:54 +01:00
parent ea1f060c94
commit 1a449cefb6
3 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,5 @@
var path = require("path");
var fs = require("fs");
var resolve = require("enhanced-resolve");
module.exports = function(optimist, argv, convertOptions) {
@ -75,11 +76,9 @@ module.exports = function(optimist, argv, convertOptions) {
if(argv.config) {
options = require(path.resolve(argv.config));
} else {
try {
options = require(path.resolve("webpack.config.js"));
} catch(e) {
options = {};
}
var configPath = path.resolve("webpack.config.js");
if(fs.existsSync(configPath))
options = require(configPath);
}
if(typeof options != "object" || options === null) {
console.log("Config did not export a object.");

View File

@ -324,7 +324,8 @@ Parser.prototype.walkVariableDeclarators = function walkVariableDeclarators(decl
switch(declarator.type) {
case "VariableDeclarator":
if(declarator.id.type === "Identifier") {
this.scope.definitions.push(declarator.id.name);
if(!this.applyPluginsBailResult("var " + declarator.id.name))
this.scope.definitions.push(declarator.id.name);
}
if(declarator.init)
this.walkExpression(declarator.init);

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "0.9.0-beta26",
"version": "0.9.0-beta27",
"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 loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
"dependencies": {