UNPKG

346 BPlain TextView Raw
1import _ from 'lodash';
2
3export function mergeWithEnvConfigs<T>(resolver: (path: string) => string, configFiles: string[], config: T): T {
4 for (const file of configFiles) {
5 try {
6 _.merge(config, require(resolver(file)).default);
7 } catch (e) {
8 if ((e as { code?: string }).code !== 'MODULE_NOT_FOUND') throw e;
9 }
10 }
11 return config;
12}