fix: stack size exceed error on purging module cache

This commit is contained in:
M. George Hansen 2020-06-14 12:06:59 -07:00
parent 6a4b1927d1
commit 13df38cff0
4 changed files with 75 additions and 26 deletions

View file

@ -5,7 +5,7 @@
import * as path from "path";
import { purgeModuleAndDepsFromCache } from "./utils";
import { decacheModule } from "./utils";
/**
* Paths used during configuration.
@ -63,7 +63,7 @@ export const loadConfig = async (rootDir: string): Promise<Config> => {
// Attempt to load a websnacks.ts/js file in rootDir.
try {
configPath = require.resolve(path.resolve(rootDir, "websnacks"));
purgeModuleAndDepsFromCache(configPath);
decacheModule(configPath);
// TODO: validate user config.
userConfig = await import(configPath);
} catch (error) {