Skip to content

Commit 7a40d0d

Browse files
committed
Use local installed webpack version, even if global command used
1 parent 22055c8 commit 7a40d0d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bin/webpack.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55
Author Tobias Koppers @sokra
66
*/
77
var path = require("path");
8+
// Local version replace global one
9+
try {
10+
var localWebpack = require.resolve(path.join(process.cwd(), "node_modules", "webpack", "bin", "webpack.js"));
11+
if(__filename != localWebpack) {
12+
return require(localWebpack);
13+
}
14+
} catch(e) {}
815
var fs = require("fs");
916
var util = require("util");
1017
var sprintf = require("sprintf").sprintf;
1118
var argv = require("optimist")
12-
.usage("Usage: $0 <input> <output>")
19+
.usage("webpack " + require("../package.json").version + "\n" +
20+
"Usage: $0 <input> <output>")
1321

1422
.boolean("min")
1523
.describe("min", "Minimize it with uglifyjs")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack",
3-
"version": "0.4.23",
3+
"version": "0.4.24",
44
"author": "Tobias Koppers @sokra",
55
"description": "Packs CommonJs 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.",
66
"dependencies": {

0 commit comments

Comments
 (0)