Skip to content

Commit

Permalink
fix(hot-reload): use cache only in prod (#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca authored Nov 17, 2024
1 parent 1459b53 commit fcdaa82
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/brisa/src/utils/process-page-route/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ export default async function processPageRoute(
route: MatchedBrisaRoute,
error?: Error,
) {
const { BUILD_DIR, IS_PRODUCTION } = getConstants();

// This cache improves the req/sec 575%
// https://github.com/brisa-build/brisa/pull/604
if (cache.has(route.filePath)) {
if (IS_PRODUCTION && cache.has(route.filePath)) {
return cache.get(route.filePath);
}

const { BUILD_DIR } = getConstants();
const module = (await import(
pathToFileURLWhenNeeded(route.filePath)
)) as PageModule;
Expand Down

0 comments on commit fcdaa82

Please sign in to comment.