aboutsummaryrefslogtreecommitdiffstats
path: root/build.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-01 06:49:19 -0700
committerAdam Soltys <[email protected]>2026-10-01 06:49:19 -0700
commit68ff290e07c0e1786cf8b8f3a87e38872ad7f8ba (patch)
treec85847c8f4a06b0a6b7dab8abb2d2eb54fefa226 /build.js
parent4b3291fdbd0b34b4d2df91a59bea93885de29508 (diff)
parent5ff909d37fe32ba04a841941593d95c7b3498ec3 (diff)
downloadcoinosv3-68ff290e07c0e1786cf8b8f3a87e38872ad7f8ba.tar.gz
coinosv3-68ff290e07c0e1786cf8b8f3a87e38872ad7f8ba.zip
Merge prod into master
Diffstat (limited to 'build.js')
-rw-r--r--build.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/build.js b/build.js
index c90e527..2bc5361 100644
--- a/build.js
+++ b/build.js
@@ -332,7 +332,13 @@ async function bundleApp({ minify, features, staging, splitting = false }) {
// The split build emits real ESM chunks (deferred features arrive as their
// own files); the single-file build inlines the dynamic imports instead.
...(splitting ? { splitting: true, format: 'esm', naming: { chunk: 'chunk-[hash].[ext]' } } : {}),
- plugins: [featurePlugin(enabledFeatures(features)), flagsPlugin(staging)],
+ plugins: [featurePlugin(enabledFeatures(features)), flagsPlugin(staging),
+ // the single file inlines every dynamic import: the video compressor
+ // (Mediabunny, ~700 KB) would ride along in a file meant to be small
+ // and offline — there it uploads the original, as before
+ ...(splitting ? [] : [{ name: 'no-video-compress', setup(build) {
+ build.onLoad({ filter: /src\/video-compress\.js$/ }, () => ({ loader: 'js', contents: 'export async function compressVideo(f) { return f; }' }));
+ } }])],
});
if (!result.success) {
for (const log of result.logs) console.error(log);
@@ -470,7 +476,10 @@ if (import.meta.main) {
const nwcSw = feats.includes('nwc') && feats.includes('ark');
const swBody = SW
.replaceAll('{{VERSION}}', version)
- .replaceAll('{{EXTRA_SHELL}}', chunks.map((c) => `, '${c.name}'`).join(''))
+ // precached for offline use — except what only works online anyway:
+ // the video compressor (Mediabunny, ~700 KB) loads when a video is
+ // picked for upload, not on every install
+ .replaceAll('{{EXTRA_SHELL}}', chunks.filter((c) => !c.text.includes('Mediabunny Codec Registry')).map((c) => `, '${c.name}'`).join(''))
.replaceAll('{{NWC_WAKE_FALLBACK}}', nwcSw ? '' : SW_WAKE_ONLY);
await Bun.write('dist/sw.js', nwcSw ? swBody + '\n' + await buildSwNwc() : swBody);
for (const f of STATIC) await Bun.write('dist/' + f, Bun.file('static/' + f));