mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 08:11:54 +00:00
Include Vite's bundle output in the manifest (#3772)
## Description: ## Summary Include Vite's bundle output (`vendor-*`, `index-*`, workers, CSS under `static/assets/`) in the asset manifest so the R2 deploy upload covers them alongside hashed source assets. Move the manifest from `static/_assets/asset-manifest.json` to `static/asset-manifest.json` since it now describes both trees, and update `update.sh` to extract the whole `static/` tree. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
This commit is contained in:
+17
-1
@@ -71,13 +71,29 @@ export default defineConfig(({ mode }) => {
|
||||
mobileLogoImageUrl: buildAssetUrl("images/OF.png", assetManifest),
|
||||
};
|
||||
|
||||
const syncHashedPublicAssets = () => ({
|
||||
let viteBundleFiles: string[] = [];
|
||||
const syncHashedPublicAssets = (): Plugin => ({
|
||||
name: "sync-hashed-public-assets",
|
||||
apply: "build" as const,
|
||||
writeBundle(_options, bundle) {
|
||||
viteBundleFiles = Object.keys(bundle);
|
||||
},
|
||||
closeBundle() {
|
||||
const outDir = path.join(__dirname, "static");
|
||||
copyRootPublicFiles(resourcesDir, outDir);
|
||||
// Run the source→hashed copy first; createHashedPublicAssetFiles iterates
|
||||
// assetManifest and expects every key to resolve to a file in resources/
|
||||
// or proprietary/. Vite's bundle output (assets/...) doesn't, so it's
|
||||
// merged in after.
|
||||
createHashedPublicAssetFiles(sourceDirs, outDir, assetManifest);
|
||||
// Track Vite's own bundle output (vendor chunks, JS, CSS, workers under
|
||||
// static/assets/) in the manifest so the deploy-time R2 upload covers
|
||||
// them alongside the hashed source assets. Skip non-assets/ emits like
|
||||
// index.html — those are served by the app, not from R2.
|
||||
for (const fileName of viteBundleFiles) {
|
||||
if (!fileName.startsWith("assets/")) continue;
|
||||
assetManifest[fileName] = `/${fileName}`;
|
||||
}
|
||||
writePublicAssetManifest(outDir, assetManifest);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user