From 877fb7e27a8567022b36e9d46130819e60ddb0d6 Mon Sep 17 00:00:00 2001 From: Jonny Buchanan Date: Tue, 20 Jun 2017 23:54:32 +1000 Subject: [PATCH] Support Webpack 3 (using peerDependencies string from webpack-defaults) --- package.json | 4 ++-- src/plugin.js | 2 +- test/plugin.test.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d5e9759..788402e 100644 --- a/package.json +++ b/package.json @@ -47,9 +47,9 @@ "expect": "^1.14.0", "mocha": "^3.0.0", "nyc": "^10.1.2", - "webpack": "^2.2.1" + "webpack": "^3.0.0" }, "peerDependencies": { - "webpack": "^1.12.0 || ^2.1.0-beta.0 || ^2.1.0" + "webpack": "^1.0.0 || ^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0" } } diff --git a/src/plugin.js b/src/plugin.js index 35b2747..f57f6c4 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -136,7 +136,7 @@ NpmInstallPlugin.prototype.resolve = function(resolver, result, callback) { ); } - if (major === "2") { + if (major === "2" || major === "3") { return this.compiler.resolvers[resolver].resolve( result.context || {}, result.path, diff --git a/test/plugin.test.js b/test/plugin.test.js index 19782c6..893800b 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -13,7 +13,7 @@ describe("plugin", function() { this.checkBabel = expect.spyOn(installer, "checkBabel"); this.compiler = { - // Webpack 2 will reject config without an entry + // Webpack >= 2 will reject config without an entry options: { entry: function() { return {} } },