diff --git a/lib/util/customConfig.js b/lib/util/customConfig.js index 1ab15994..54864527 100644 --- a/lib/util/customConfig.js +++ b/lib/util/customConfig.js @@ -38,7 +38,7 @@ function requireUncached(module) { * @param {string|Object} config * @returns `null` when unchanged, `{}` when not found */ -function loadConfig(config) { +function loadConfig(config, newConfig) { let loadedConfig = null; if (typeof config === 'string') { const resolvedPath = path.isAbsolute(config) ? config : path.join(path.resolve(), config); @@ -48,7 +48,7 @@ function loadConfig(config) { if (stats === null) { // Default to no config loadedConfig = {}; - } else if (lastModifiedDate !== mtime) { + } else if (lastModifiedDate !== mtime || newConfig) { // Load the config based on path lastModifiedDate = mtime; loadedConfig = requireUncached(resolvedPath); @@ -66,6 +66,7 @@ function loadConfig(config) { if (typeof config === 'object' && config !== null) { return config; } + lastModifiedDate = null; return {}; } } @@ -88,7 +89,7 @@ function resolve(twConfig) { if (newConfig || expired) { previousConfig = twConfig; lastCheck = now; - const userConfig = loadConfig(twConfig); + const userConfig = loadConfig(twConfig, newConfig); // userConfig is null when config file was not modified if (userConfig !== null) { mergedConfig = resolveConfig(userConfig);