diff --git a/scripts/post-web-build.js b/scripts/post-web-build.js
index 5db3788545..baaa7cb8b7 100644
--- a/scripts/post-web-build.js
+++ b/scripts/post-web-build.js
@@ -2,7 +2,6 @@ const path = require('path')
const fs = require('fs')
const projectRoot = path.join(__dirname, '..')
-const webBuildJs = path.join(projectRoot, 'web-build', 'static', 'js')
const templateFile = path.join(
projectRoot,
'bskyweb',
@@ -10,18 +9,18 @@ const templateFile = path.join(
'scripts.html',
)
-const jsFiles = fs.readdirSync(webBuildJs).filter(name => name.endsWith('.js'))
-jsFiles.sort((a, b) => {
- // make sure main is written last
- if (a.startsWith('main')) return 1
- if (b.startsWith('main')) return -1
- return a.localeCompare(b)
-})
+const {entrypoints} = require(path.join(
+ projectRoot,
+ 'web-build/asset-manifest.json',
+))
-console.log(`Found ${jsFiles.length} js files in web-build`)
+console.log(`Found ${entrypoints.length} entrypoints`)
console.log(`Writing ${templateFile}`)
-const outputFile = jsFiles
- .map(name => ``)
+const outputFile = entrypoints
+ .map(name => {
+ const file = path.basename(name)
+ return ``
+ })
.join('\n')
fs.writeFileSync(templateFile, outputFile)