Include emitted chunks in release manifest

This commit is contained in:
Jeppe Bundgaard
2026-06-03 21:12:08 +02:00
parent 270f87dee1
commit c5fcb90683
+28
View File
@@ -130,6 +130,32 @@ function releaseManifestHash(filePath) {
}
}
function releaseDistAssetUrls(outputDirectory) {
const assetUrls = []
const walk = (directory) => {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const absolutePath = path.join(directory, entry.name)
const relativePath = path.relative(outputDirectory, absolutePath).replace(/\\/g, '/')
if (entry.isDirectory()) {
walk(absolutePath)
continue
}
if (!entry.isFile()) {
continue
}
if (relativePath === 'release-manifest.json' || relativePath === '.htaccess') {
continue
}
assetUrls.push(`/${relativePath}`)
}
}
walk(outputDirectory)
return assetUrls
}
function patchBuefyCssMediaQuery() {
return {
name: 'patch-buefy-css-media-query',
@@ -275,6 +301,7 @@ function releaseMetadataManifest() {
const releaseEntry = JSON.parse(fs.readFileSync(releaseEntryPath, 'utf8'))
const indexHtml = fs.readFileSync(indexPath, 'utf8')
const rootFiles = fs.readdirSync(outputDirectory)
const emittedAssetUrls = releaseDistAssetUrls(outputDirectory)
const indexAssetUrls = Array.from(indexHtml.matchAll(/\b(?:href|src)=["']([^"']+)["']/g))
.map((match) => releaseUrlPath(match[1], '/index.html'))
.filter(Boolean)
@@ -318,6 +345,7 @@ function releaseMetadataManifest() {
const criticalAssetUrls = Array.from(new Set([
'/index.html',
'/release-entry.json',
...emittedAssetUrls,
...indexAssetUrls,
...releaseEntryAssetUrls,
...pwaAssetUrls