From 90dedd7b80e1897f15842fd28b9884fcb08d8d9d Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Thu, 11 Aug 2016 07:30:13 -0400 Subject: [PATCH] resolvers/webpack/v0.5.1: hotfix for when no webpack config is found (i.e. node_modules) --- resolvers/webpack/CHANGELOG.md | 4 ++++ resolvers/webpack/index.js | 7 ++++++- resolvers/webpack/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/resolvers/webpack/CHANGELOG.md b/resolvers/webpack/CHANGELOG.md index 49ffdb3db..871a06ac0 100644 --- a/resolvers/webpack/CHANGELOG.md +++ b/resolvers/webpack/CHANGELOG.md @@ -5,6 +5,10 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel ## Unreleased +## 0.5.1 - 2016-08-11 +### Fixed +- don't throw and die if no webpack config is found + ## 0.5.0 - 2016-08-11 ### Added - support for Webpack 2 + `module` package.json key! ([#475], thanks [@taion]) diff --git a/resolvers/webpack/index.js b/resolvers/webpack/index.js index 43f81263e..18783d3fe 100644 --- a/resolvers/webpack/index.js +++ b/resolvers/webpack/index.js @@ -61,7 +61,12 @@ exports.resolve = function (source, file, settings) { configPath = findConfigPath(configPath, packageDir) log('Config path resolved to:', configPath) - webpackConfig = require(configPath) + if (configPath) { + webpackConfig = require(configPath) + } else { + log("No config path found relative to", file, "; using {}") + webpackConfig = {} + } if (webpackConfig && webpackConfig.default) { log('Using ES6 module "default" key instead of module.exports.') diff --git a/resolvers/webpack/package.json b/resolvers/webpack/package.json index 613d995b2..9ac5a60a0 100644 --- a/resolvers/webpack/package.json +++ b/resolvers/webpack/package.json @@ -1,6 +1,6 @@ { "name": "eslint-import-resolver-webpack", - "version": "0.5.0", + "version": "0.5.1", "description": "Resolve paths to dependencies, given a webpack.config.js. Plugin for eslint-plugin-import.", "main": "index.js", "scripts": {