Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/util/customConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ function requireUncached(module) {
/**
* Load the config from a path string or parsed from an object
* @param {string|Object} config
* @param {object} options
* @param {boolean} options.newConfig when the config has a different path we must resolve even if mtime is the same
* @returns `null` when unchanged, `{}` when not found
*/
function loadConfig(config) {
function loadConfig(config, options) {
let loadedConfig = null;
if (typeof config === 'string') {
const resolvedPath = path.isAbsolute(config) ? config : path.join(path.resolve(), config);
Expand All @@ -48,7 +50,7 @@ function loadConfig(config) {
if (stats === null) {
// Default to no config
loadedConfig = {};
} else if (lastModifiedDate !== mtime) {
} else if (options.newConfig || lastModifiedDate !== mtime) {
// Load the config based on path
lastModifiedDate = mtime;
loadedConfig = requireUncached(resolvedPath);
Expand Down Expand Up @@ -88,7 +90,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);
Expand Down