diff --git a/lib/config.js b/lib/config.js index 5d3b0f0..d413331 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,6 +1,6 @@ const path = require('path') const Joi = require('joi') -const micromatch = require('micromatch') +const {makeRe} = require('micromatch') const union = require('lodash.union') const merge = require('lodash.merge') const {accessSync} = require('fs') @@ -214,7 +214,7 @@ module.exports = class Config { this.resolveLoader = merge(opts.resolveLoader, this.resolveLoader) } - const reIgnores = opts.ignore.map(mmToRe) + const reIgnores = opts.ignore.map(makeRe) const spikeLoaders = [ { exclude: reIgnores, @@ -289,15 +289,15 @@ module.exports = class Config { function loadFile (f) { try { accessSync(f) - return require(f) } catch (err) { - if (err.code !== 'ENOENT') { throw new Error(err) } - return {} + throw err } -} -function mmToRe (mm) { - return micromatch.makeRe(mm) + try { + return require(f) + } catch (err) { + throw err + } } function removeKeys (obj, keys) {