Skip to content

Commit 55d5f01

Browse files
committed
use node global context to get assetManifest. Relies on the Antora extension
1 parent 626aeb3 commit 55d5f01

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/helpers/assets-manifest.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
'use strict'
22

3-
const { execSync } = require('child_process')
4-
const fs = require('fs')
53
const logger = require('@antora/logger')('assets-manifest-helper')
64

75
module.exports = (assetPath) => {
8-
let manifestPath
9-
let manifest
10-
try {
11-
manifestPath = execSync('find ./build/site -name assets-manifest.json').toString().trim()
12-
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'))
13-
} catch (err) {
14-
logger.error(err)
6+
const manifest = global.assetsManifest
7+
if (!manifest) {
8+
logger.error(
9+
`
10+
Assets manifest not found in global context.
11+
The .js and .css files from the UI bundle will not be linked properly in the HTML.
12+
Ensure assets-manifest.json from the UI bundle is parsed and added
13+
to global.assetsManifest after uiLoader is complete.
14+
`
15+
)
16+
return assetPath
1517
}
16-
if (manifest) return manifest[assetPath]
17-
return assetPath
18+
return manifest[assetPath]
1819
}

0 commit comments

Comments
 (0)