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

@ -8,7 +8,7 @@ import * as path from "path";
import { Config, ConfigPaths } from "./config";
import { renderPage } from "./render";
import { purgeModuleAndDepsFromCache, walkDir } from "./utils";
import { decacheModule, walkDir } from "./utils";
const renderPagesToHtml = async ({
pagesDir,
@ -22,7 +22,7 @@ const renderPagesToHtml = async ({
}
// Ensure that we don't cache page modules when running in dev server.
purgeModuleAndDepsFromCache(srcPath);
decacheModule(srcPath);
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pageSrc = require(srcPath);
if (!("page" in pageSrc)) {