Skip to content

Commit ade1a2e

Browse files
committed
fix: add fallback in case findModuleBase will be false
1 parent bbff3a9 commit ade1a2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/runtime/src/helpers/analysis.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ export const extractConfigFromFile = async (apiFilePath: string, appDir: string)
9494
extractConstValue = require(findModuleFromBase({
9595
paths: [appDir],
9696
candidates: ['next/dist/build/analysis/extract-const-value'],
97-
}))
97+
}) ?? 'next/dist/build/analysis/extract-const-value')
9898
}
9999
if (!parseModule) {
100100
// eslint-disable-next-line prefer-destructuring, @typescript-eslint/no-var-requires, import/no-dynamic-require
101101
parseModule = require(findModuleFromBase({
102102
paths: [appDir],
103103
candidates: ['next/dist/build/analysis/parse-module'],
104-
})).parseModule
104+
}) ?? 'next/dist/build/analysis/parse-module').parseModule
105105
}
106106
} catch (error) {
107107
if (error.code === 'MODULE_NOT_FOUND') {

0 commit comments

Comments
 (0)