Skip to content

Commit 5af0fdb

Browse files
authored
fix(processor): resolve metadata extraction failure on Vercel (#179)
1 parent 5c8a41e commit 5af0fdb

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

plugins/processor/source.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,11 @@ const attachSourceMetadata = (reflection, sourceEntry, exportEntry) => {
678678
});
679679
};
680680

681+
const getWebpackPath = () => {
682+
const versions = JSON.parse(readFileSync('./versions.json'));
683+
return versions ? `./.cache/webpack/${versions[0]}/lib` : `./webpack/lib`;
684+
};
685+
681686
/**
682687
* Enrich declaration reflections with comments and source locations recovered
683688
* from webpack/lib. The declaration file remains authoritative for public API
@@ -686,11 +691,8 @@ const attachSourceMetadata = (reflection, sourceEntry, exportEntry) => {
686691
* @param {import('typedoc').ProjectReflection} project
687692
* @param {{ libDir?: string }} [options]
688693
*/
689-
export const applySourceMetadata = (
690-
project,
691-
{ libDir = './webpack/lib' } = {}
692-
) => {
693-
const absoluteLibDir = resolve(libDir);
694+
export const applySourceMetadata = project => {
695+
const absoluteLibDir = resolve(getWebpackPath());
694696
if (!existsSync(absoluteLibDir) || !statSync(absoluteLibDir).isDirectory()) {
695697
return;
696698
}

0 commit comments

Comments
 (0)