You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace the app's own PWA package with an all-in-one toolkit once one supports Bun #166
Owner's wish: an all-in-one PWA toolkit instead of our own package.
Today packages/pwa (#157) combines favicons (icons, manifest, head tags) and Serwist (service worker, update prompt) behind one pwa-build step, because no single tool does all of it for Bun: vite-plugin-pwa is Vite-only, and its bundler-independent successor unplugin-pwa is not on npm and lists no Bun target (only Vite and Rolldown are marked ready).
Revisit when:unplugin-pwa (or another toolkit) publishes a release that supports Bun's bundler. Then: replace packages/pwa with it, keeping what the e2e check (#159) proves: installable, offline, update prompt.
In principle yes: unplugin itself supports Bun. A plugin built with it exposes a /bun entry that goes straight into Bun.build({ plugins: [...] }), and on Bun it gets buildStart, resolveId, load, transform, and since Bun 1.3 buildEnd and writeBundle (the unplugin guide has the table). writeBundle is the hook a PWA toolkit needs to write the service worker after the build.
In practice not yet, for unplugin-pwa specifically:
nothing is published: every package in vite-pwa/unplugin-pwa is still 0.0.0, and there is no /bun entry;
the only bundler package is packages/vite, and the repository doesn't mention Bun anywhere;
putting the manifest and icon links into index.html uses Vite's transformIndexHtml, which unplugin has no portable equivalent for; on Bun that part would need its own code (as packages/pwa does with Bun's HTMLRewriter).
So this issue stays open until unplugin-pwa publishes a release with a Bun entry. Asking for one is a conversation for that project's maintainers.
Re-evaluated with a fresh research pass (owner's request), as of 2026-10-11. Still no published all-in-one PWA toolkit for Bun's bundler; keep packages/pwa, keep this open.
What changed:
unplugin-pwa reserved its npm names (@unplugin-pwa/core, vite, types, inspector, all 0.0.0 on 2026-10-03), but they are placeholders (module.exports = {}). The repo is very active (commits almost daily); its first release is vite-pwa/unplugin-pwa#4 ("v0.0.1", timetable to be announced), with open pre-release tasks in Connect Google Calendar: create, share and join the household calendar #5 (vite-pwa/unplugin-pwa#5). Its README lists Vite, Rolldown, Webpack/Rspack/Rsbuild (WIP); no Bun. It compiles the service worker through vite-pwa's own Workbox fork (@vite-pwa/workbox-build), which only has Vite and Rolldown builders.
vite-plugin-pwa 2.0.0 is still Vite-only; driving it from a Bun script would need a faked Vite config, Vite itself to compile the worker, and the transformIndexHtml and virtual: module parts rebuilt.
Serwist has no esbuild/Bun integration and no manifest/icon generation; @serwist/cli wraps the same injectManifest call packages/pwa already makes.
Bun plugins still have no counterpart to Vite's transformIndexHtml; oven-sh/bun#40259 still open.
Nothing else qualifies: @vite-pwa/assets-generator (icons only, lateral to favicons), pwa-asset-generator (Puppeteer + Chrome), @pwabuilder/cli (2024, starters only), no Bun/esbuild PWA plugin on npm.
Reopen when one of these happens:
@unplugin-pwa/core publishes a real release and a Bun target lands (an @unplugin-pwa/bun package or /bun export), or @vite-pwa/workbox-build gains a Bun/esbuild worker builder;
Serwist ships a bundler-independent integration that also generates the manifest and icons;
Bun adds an HTML-transform hook for plugins.
Note for (1): adopting it would mean leaving Serwist for vite-pwa's Workbox fork, a trade-off to weigh then, not a free upgrade.
Addendum from the same re-evaluation: ways to make packages/pwa smaller while no toolkit exists (ideas, not decided):
Run it as a Bun plugin inside the build (Bun.build({ plugins: [pwa(config)] }), using Bun's onEnd hook) instead of a separate pwa-build step: same code, no new dependency, and the shape an unplugin-pwa Bun adapter would later replace. The HTMLRewriter step stays (Bun has no transformIndexHtml).
Smaller icons: SVG icons with sizes="any" plus a few PNG fallbacks rendered by @resvg/resvg-wasm (no native binary) would replace favicons + sharp; we'd write the manifest and head tags ourselves. Only worth it if dropping sharp matters. realfavicon (pre-1.0) is the nearest alternative to favicons, and also injects the head tags.
Bundler question (Build the app with Bun instead of Vite #146): Vite 8 now bundles with Rolldown, so much of the speed argument for Bun's bundler is gone, and vite-plugin-pwa 2.0.0 works there today. Staying on Vite for bundling only (Bun remains package manager, runtime and test runner) would drop packages/pwa entirely, at the cost of the "Bun only" goal. Build the app with Bun instead of Vite #146 is blocked on oven-sh/bun#40259 anyway. This is the owner's call.
@unplugin-pwa/core is an abstraction to handle PWA configuration. We can build a Bun adapter on top of it, but we'll still use Rolldown to build the service worker.
On the other hand, we could potentially add a native Bun builder to @vite-pwa/workbox-build. However, generating the service worker in an isolated production build is just half the battle. Integrating it seamlessly into Bun's lifecycle poses real challenges. As mentioned in this thread, Bun's plugin API currently lacks standard hooks for injecting assets into HTML (like Vite's transformIndexHtml), and resolving virtual modules requires significant custom logic.
Alternatively, we can create a Bun plugin and use Rolldown under the hood, like we did for Webpack or Rspack/Rsbuild (check Webpack build plugin).
Right now this deep integration is out of our initial scope, but we might explore support in the future as the Bun plugin ecosystem matures.
Thank you for the context, that matches what we found: a Bun adapter would still need Rolldown for the worker, and the missing HTML hook in Bun's plugin API (oven-sh/bun#40259) is the harder half. We keep our own packages/pwa for now and leave this open for when Bun's plugin hooks or a Bun target in vite-pwa/unplugin-pwa make it possible.
Activity
Flixbox commentedon Oct 11, 2026
Would unplugin work via Bun.build({ plugins: [...] }) ?
flixbox-ai-agent commentedon Oct 11, 2026
In principle yes:
unpluginitself supports Bun. A plugin built with it exposes a/bunentry that goes straight intoBun.build({ plugins: [...] }), and on Bun it getsbuildStart,resolveId,load,transform, and since Bun 1.3buildEndandwriteBundle(the unplugin guide has the table).writeBundleis the hook a PWA toolkit needs to write the service worker after the build.In practice not yet, for
unplugin-pwaspecifically:0.0.0, and there is no/bunentry;packages/vite, and the repository doesn't mention Bun anywhere;index.htmluses Vite'stransformIndexHtml, which unplugin has no portable equivalent for; on Bun that part would need its own code (aspackages/pwadoes with Bun'sHTMLRewriter).So this issue stays open until
unplugin-pwapublishes a release with a Bun entry. Asking for one is a conversation for that project's maintainers.flixbox-ai-agent commentedon Oct 11, 2026
Re-evaluated with a fresh research pass (owner's request), as of 2026-10-11. Still no published all-in-one PWA toolkit for Bun's bundler; keep
packages/pwa, keep this open.What changed:
unplugin-pwareserved its npm names (@unplugin-pwa/core,vite,types,inspector, all0.0.0on 2026-10-03), but they are placeholders (module.exports = {}). The repo is very active (commits almost daily); its first release isvite-pwa/unplugin-pwa#4("v0.0.1", timetable to be announced), with open pre-release tasks in Connect Google Calendar: create, share and join the household calendar #5 (vite-pwa/unplugin-pwa#5). Its README lists Vite, Rolldown, Webpack/Rspack/Rsbuild (WIP); no Bun. It compiles the service worker through vite-pwa's own Workbox fork (@vite-pwa/workbox-build), which only has Vite and Rolldown builders.vite-plugin-pwa2.0.0 is still Vite-only; driving it from a Bun script would need a faked Vite config, Vite itself to compile the worker, and thetransformIndexHtmlandvirtual:module parts rebuilt.@serwist/cliwraps the sameinjectManifestcallpackages/pwaalready makes.transformIndexHtml;oven-sh/bun#40259still open.@vite-pwa/assets-generator(icons only, lateral tofavicons),pwa-asset-generator(Puppeteer + Chrome),@pwabuilder/cli(2024, starters only), no Bun/esbuild PWA plugin on npm.Reopen when one of these happens:
@unplugin-pwa/corepublishes a real release and a Bun target lands (an@unplugin-pwa/bunpackage or/bunexport), or@vite-pwa/workbox-buildgains a Bun/esbuild worker builder;Note for (1): adopting it would mean leaving Serwist for vite-pwa's Workbox fork, a trade-off to weigh then, not a free upgrade.
flixbox-ai-agent commentedon Oct 11, 2026
Addendum from the same re-evaluation: ways to make
packages/pwasmaller while no toolkit exists (ideas, not decided):Bun.build({ plugins: [pwa(config)] }), using Bun'sonEndhook) instead of a separatepwa-buildstep: same code, no new dependency, and the shape anunplugin-pwaBun adapter would later replace. TheHTMLRewriterstep stays (Bun has notransformIndexHtml).@serwist/build: we only use it to fill in the precache list;Bun.Glob+Bun.hash+ the existingdefinecould do it in ~20 lines (plus our own duplicate-URL check, The offline app doesn't update, and the browser console shows errors on the live site #136). Optionally drop@serwist/windowtoo (~30 lines of plain service-worker API).sizes="any"plus a few PNG fallbacks rendered by@resvg/resvg-wasm(no native binary) would replacefavicons+sharp; we'd write the manifest and head tags ourselves. Only worth it if droppingsharpmatters.realfavicon(pre-1.0) is the nearest alternative tofavicons, and also injects the head tags.vite-plugin-pwa2.0.0 works there today. Staying on Vite for bundling only (Bun remains package manager, runtime and test runner) would droppackages/pwaentirely, at the cost of the "Bun only" goal. Build the app with Bun instead of Vite #146 is blocked onoven-sh/bun#40259anyway. This is the owner's call.userquin commentedon Oct 12, 2026
@unplugin-pwa/coreis an abstraction to handle PWA configuration. We can build a Bun adapter on top of it, but we'll still use Rolldown to build the service worker.On the other hand, we could potentially add a native Bun builder to
@vite-pwa/workbox-build. However, generating the service worker in an isolated production build is just half the battle. Integrating it seamlessly into Bun's lifecycle poses real challenges. As mentioned in this thread, Bun's plugin API currently lacks standard hooks for injecting assets into HTML (like Vite'stransformIndexHtml), and resolving virtual modules requires significant custom logic.Alternatively, we can create a Bun plugin and use Rolldown under the hood, like we did for Webpack or Rspack/Rsbuild (check Webpack build plugin).
Right now this deep integration is out of our initial scope, but we might explore support in the future as the Bun plugin ecosystem matures.
flixbox-ai-agent commentedon Oct 15, 2026
Thank you for the context, that matches what we found: a Bun adapter would still need Rolldown for the worker, and the missing HTML hook in Bun's plugin API (
oven-sh/bun#40259) is the harder half. We keep our ownpackages/pwafor now and leave this open for when Bun's plugin hooks or a Bun target invite-pwa/unplugin-pwamake it possible.