#Remix PWA

1 messages ยท Page 2 of 1

lone solar
#

ah, maybe that was merged after you'd already branched off to work on Vite compat

midnight steeple
#

He did. It's just not released as latest (still in pre-release state). To use it, run npm i @remix-pwa/sw@dev @remix-pwa/cache@dev ๐Ÿ‘

#

Actually, @remix-pwa/cache@latest

lone solar
#

hmm, doesn't seem to help

midnight steeple
#

Welp, would just go ahead and make them all compatible in the coming days ๐Ÿ˜…

lone solar
#

yeah haha sounds good - go to bed! ๐Ÿ™‚

midnight steeple
midnight steeple
#

Interesting. So remix build style now means you have one production and one development worker. No longer in the same place

#

Just realised remix is strict about route exports so workerLoader and workerAction don't work ๐Ÿคฆโ€โ™‚๏ธ

#

Hopefully, Remix would give official support for workerLoader/Action

midnight steeple
#

On a second note, how about I solve worker export issues myself and bring support sooner ๐Ÿ˜

midnight steeple
midnight steeple
#

One more tiny fix before they come online tho, just learned Remix approach to fetching has changed seriously so I am not sure how to differentiate loader and action fetches from other fetches yet, but once I do ๐Ÿ‘

midnight steeple
#

Mini-update regarding docs:
Done some mini work on the site including the ground work for versioning (multiple versions now have separate docs)
Also, got Remix PWA v2 a sub-domain: https://v2.remix-pwa.run

Progressively enhance your Remix application with PWA features like never before.

weary coral
midnight steeple
#

The site isn't built with Vite. I haven't updated it and it still uses Remix v1.smthg.

It also doesn't contain any info on Vite in Remix PWA. Remix PWA is currently at v3, the v2 docs is the old docs. I just changed the url from a vercel subdomain to a remix PWA subdomain.

weary coral
#

Ah sorry, then I misunderstood

midnight steeple
#

Regarding why no unofficial doc is out yet, the Remix team is on holiday and I have one major issue I am still trying to figure out. Regarding route workers. Namely how loaders and actions are fetched in the newer versions of vite

midnight steeple
weary coral
#

The reason I've been pretty insistent with vite support is because it's blocking a rather large update to my project. https://github.com/IgnisDa/ryot/pull/478

(I don't say this to egg you. I just thought you should know the reason why I've been following that issue closely)

GitHub

This changes the frontend to be server side rendered.
Fixes #134.
Fixes #507.
Fixes #508.
Fixes #514.
Fixes #515.

Blocked by remix-pwa/remix-pwa#136

midnight steeple
#

Would go at it again later today 4459_ComfyBlob

midnight steeple
#

@weary coral Do you have a mini project (sandbox) you currently use to test out Vite + Remix? Asking cause I just discovered smthg weird I added into Remix PWA. Try using workerLoader/Action without exporting it.

// no `export` keyword
const workerLoader = () = {...}
#

I want to confirm it isn't an anomaly and it's been released

#

If it works, I need to release a new eslint package telling ESLint to shut up about unused functions and bypass worker route apis being unused

#

If it works, then yeah, that wraps up major pre-release and that means all past features has been successfully migrated to Vite

weary coral
midnight steeple
#

I don't want to rush releasing a package that hasn't been fully dusted and tested. Last excuse for this delay is work just got hectic af. And it's prob. gonna stay that way for most of January too. Again, sorry for the delay ๐Ÿ™

weary coral
midnight steeple
#

Built from the ground up with no dependencies, integrates well with vite and much faster than former approaches due to a more concise interface between your app and the cache

#

Also introducing EnhancedCache, a universal cache that I went wild with. Ships with about 7 utilities rn (with more on the way) including precaching and cache versioning (still polishing this)

#

I am also re-writing precaching and JiT caching. That one isn't out yet though 4459_ComfyBlob

midnight steeple
#

@still wadi Hola ๐Ÿ‘‹! I am currently writing the new precache handler for remix pwa and I am accounting use cases like the one you raised earlier (fully offline app), I tried going through your service worker to have an idea of how you did it but tbh, I am getting lost pretty easily.
Did you just fetch the entire Remix route manifest on activation? Or did you take a separate approach?

#

I am thinking of an API that looks roughly like this:

new Precache({
  offline: true, //automatically tags your app as offline-first?
  blackListRoutes: [], // routes to automatically remove (that require live data, for example)
  routes: [], // if you don't prefer offline and just want to precache some assets
  cache: string | EnhancedCache, // would honestly prefer enhanced cache here - probs enforce i
})
#

Still thinking the DX out. It might turn out better or worse than this ๐Ÿ˜‚

midnight steeple
#

Would be waiting for a helping hand regarding that (precaching).
As for useSWEffect, it's unfortunately going nowhere. Tho, I have reduced the SW reliance on it and it's size, but it's still critical for caching documents (html). I tried injection via vite but it started to get very complicated and I am not going there.

still wadi
#

Hi @midnight steeple , I did inject the manifest in the service worker and intercepted it for NavigateRequest and DataRequest.
On full refresh the html will be rewritten to find the matching routes and replace them via the matchRoutes, createRoutes, getKeyedLinksForMatches etc methods provided in the manifest and react router.
This is similar to everything in remix-react/components.tsx. Only then can we provide offline support for any page without pre-rendering.

#

By default on the first visit it will precache /?shell=true which will return an html template identifying what needs to be replaced. It will then be replaced in the service worker and returned.

midnight steeple
#

Wow! I commend your project ๐Ÿ‘. It is very good and contains quite a lot of smart solutions chefkiss

still wadi
#

If I want to have the ability of service worker, I think I will use const worker = new Worker('my_worker.js') regardless of whether it is a PWA or not.

midnight steeple
#

Preview of EnhancedCache ๐Ÿ˜. I wish I could release this much sooner but the lack of access to assets in dev environment makes caching one sided (you have to be in production mode - build everytime - to test caching), and as such, incomplete imo

midnight steeple
#

Auto versioning now being shipped too ๐Ÿ‘. Cleanup old caches with ease partyparrot

#

More features in the pipeline, current obstacle to a release is Remix team still stabilizing Remix Vite API. Would release nightly versions soon so you can also test

#

|| Very early announcement: || Thanks to Ray again, a new runtime is coming soon ๐ŸŽ‰! @remix-pwa/precache-runtime. Includes a few new APIs compared to the current runtimes, best suited for offline-first/local-first PWAs as well as full offline support. I have also figured out (mostly) how to wrap workbox into a runtime. So we should hopefully see smthg on Workbox in Remix Q1 this yr

midnight steeple
#

Currently experimenting with removing the need for the self.addEventListener('message', (e) => {...}) and so far, it works! Plus, it's really easy to build yours. Simple instantiate the handler in your service worker and that's all. Remix PWA now takes care of the rest

#

I would be doing a nightly this week for sw package and deprecating the strategy and cache package later this month

#

With this working, having a PrecacheController or PrecacheHandler is much easier!

midnight steeple
midnight steeple
midnight steeple
#

At this point, Remix PWA is good to go for non-precache use cases in vite ๐Ÿ‘. Ciao

limber escarp
#

has anyone published a remix pwa to the app store?

midnight steeple
#

I don't think so. Tried to do so once but the amount of work Google wanted to drive me through wasn't worth it imo (it was for a demo)

#

But I have generated signed APKs with remix-pwa before via https://pwabuilder.com

midnight steeple
#

Merging the current to main should occur later this month (hopefully). precaching comes out in the next major release after (delayed) ๐Ÿ˜ฌ, I would also be working on the docs in the meantime.

# Current versions to use/test the latest features
- @remix-pwa/sw: 2.2.0-dev.2  # dependency
- @remix-pwa/dev: 2.1.0-dev.5  # devDependency
- @remix-pwa/worker-runtime: 2.1.0-dev.1  # devDependency

sw now ships with sub-module imports for better treeshaking. For example:

import { useSWEffect } from '@remix-pwa/sw/use-sw-effect'

// ...

export default function App() {
  useSWEffect()
} 

Speaking of useSWEffect. It now ships with a new API:

type UseSWEffectOptions = {
    cacheType?: 'jit';
} | {
    cacheType?: 'precache';
} | {
    cacheType: 'custom';
    eventName: string;
    payload?: any;
};

// defaults to `useSWEffect({ cacheType: 'jit' })` if nothing is passed
function useSWEffect(options?: UseSWEffectOptions): void;

You now specify your caching method via the hook. It can additionally be used to send custom messages to the worker when a navigation or document refresh occurs (everytime a user moves around your site). For example:

useSWEffect({
  cacheType: 'custom', // reading this again, this should be named smthg else
  eventName: 'MY_CUSTOM_EVENT', // name of your custom event - should be unique
  payload: { usersOnline: 4_029 } // custom info that would be send to the worker too
})

Would expantiate more on this in the documentation which should be shipping out around the time the releases are merged to main.

Regarding the worker, there a few new chnges. Most important is the removal of the need for the message listener. Just a navigation handler and you are good to go. Btw, the API ships with the following:

type NavigationHandlerOptions = {
  allowList?: string[] | RegExp[]; // by default, all routes are allowed
  denyList?: string[] | RegExp[]; // banned routes. they won't be interacted with at all
  documentCache: EnhancedCache | string; // name of the cache to cache the HTML of your routes. If a string is passed, would be converted
};

The worker-runtime now takes care of calling it at it's appropriate time, creating your own message interceptor is easy, just includes extending the abstract MessageHandler class, registering your custom event, and now useSWEffect would send your custom event and the runtime would handle the rest. Docs incomming (hopefully)

The major deprecation incoming is the cache and strategy package. By simplifying the process more (I must say, the previous methods were complex), not only do we get better UX but also perfomance and speed ๐Ÿ˜. Worker loader and actions still retain the same APIs, no new changes incoming on that end.

Though, I am still deciding wether precache runtimes should support them or discard them? I am trying to create multiple use cases and they seem to just complicate the caching process more and more. Maybe there's something I am not factoring in? Would love to hear inputs from anyone interested. Btw, if you still use Remix Esbuild (non-vite), the new versions still support and would keep supporting them. remix-pwa CLI support would be dropped soon (or I might just revamp it, idk). Work schedule is quite hectic atm so I would be doing things in small steps for the time being. Contributions are welcomed, thank you in advance! pikachu

idle valley
#

Nice work man.
I only use caches API (to cache my offline.html), so, not the best to help here ๐Ÿ˜„

lone solar
#

@midnight steeple is there an example entry.worker.ts that works with the new Vite/dev stuff? I found the playground one included in your big PR but it has registerQueue from @remix-pwa/sync and some database thing, etc. - not sure what's safe to strip out

midnight steeple
midnight steeple
#

It's actually the same with the dev branch. Strip out anything that has to do with context and database stores, as well as the sync stuffs

#

Only the cache, navigation handler and the install and activate listeners are included

midnight steeple
#

Still heavily a WiP, docs should start releasing soon enough ๐Ÿ‘

lone solar
midnight steeple
#

Assets are only cached in prod

#

I'm still figuring out the tiny details left for asset caching in dev, even if it's a minor caching

#

But in the service worker, you can remove it and your app would still work

lone solar
#

Are you seeing this in VSCode by chance? Seems to work, so not sure why it's crying.

midnight steeple
#

If it is still there, can just import from /sw

lone solar
lone solar
midnight steeple
#

Well, importing from /sw/use-sw-effect imports only the hook file and typings instead of the whole thing. By default, Vite treeshakes, but sometimes, tiny extras can creep in

#

So, it depends on how vite decides to remove unwanted imports. The exports are structured so they can easily be stripped by a bundler

#

But you can never say just how much would be stripped

lone solar
#

just tested both ways, doesn't appear to make a difference ๐Ÿ‘

midnight steeple
#

Seems to treeshake very well, ๐Ÿ‘. Nice to know Vite has a fantastic tree-shaking

midnight steeple
#

Remix PWA site is down. Seems I broke deployment and can't even figure it out (yet)

midnight steeple
#

Yayyy! We are back online. Now has versioning (dev is a WiP). The whole site is still undergoing some changes but the docs are now rolling out
https://remix-pwa.run/

The home of Remix PWA. Enhance your Remix application with PWA functionalities like never before.

#

Wtf is that image

#

or 2

#

The site is still broken. I seem to have made it worse ๐Ÿ˜‚, can I rollback on fly? Hope so

#

Rollback successful.

solar wave
#

Wish I could be able to follow more all the updates and the work you've been doing with Remix PWA @midnight steeple! Added my little grain of salt to your GitHub sponsors! Keep it up mate!

midnight steeple
idle valley
midnight steeple
#

Remix + Swift incoming comfyblob

#

Jk, you would need to bribe me and hold me at gunpoint to create an OSS project for Apple ecosystem

sturdy swallow
midnight steeple
idle valley
#

Crisis call yesterday with my client. Let's see what happens.
Fallback is an expo app, using Remix and or Hono as API

#

Or trying to bundle a pwa in a native shell ๐Ÿคฃ๐Ÿคฃ

modest holly
#

i like pwas personally

#

like as a "user"

idle valley
midnight steeple
idle valley
midnight steeple
idle valley
midnight steeple
#

lolsob I'm confused ๐Ÿ˜ญ

midnight steeple
midnight steeple
# modest holly wh yis it good

Not related to PWA, generally building in JSX. Web components allow for versatility with custom elements and behaviors. Think reusable behavior in HTML

https://developer.mozilla.org/en-US/docs/Web/API/Web_components

MDN Web Docs

Web Components is a suite of different technologies allowing you to create reusable custom elements โ€” with their functionality encapsulated away from the rest of your code โ€” and utilize them in your web apps.

#

I haven't played around with it, but I hope to dive in once it gets to nightly

midnight steeple
idle valley
#

PWAs are dead in EU on iOS... All these months of work lost...

midnight steeple
#

Not the end of the road imo, I've seen a small project integrating Vite with React Native. I'm exploring it, since Remix is just a vite plugin, how easy would it be to just fuse them?

idle valley
#

Tomorrow, I have to announce that to my client. 1,5 years building his project...

midnight steeple
#

Sht. That's a long time ๐Ÿ˜ž

idle valley
#

Bye invested money (and a part from EU ๐Ÿ˜‚). An me who told him to trust me, PWA was the future....

#

I can't even guarantee that a native app will be accepted by Apple ๐Ÿ™„

midnight steeple
#

I would be patching Remix PWA but would start exploring Remix Native lolsob

#

Apple users are too many to ignore

zenith pulsar
zenith pulsar
idle valley
#

I LOVE so much Remix. I can't imagine starting from scratch on something else

#

My loaders, actions, fetchers ๐Ÿ˜ญ

zenith pulsar
#

Yup feels bad

#

It might be hard now but we have to move forward

#

All the best ๐Ÿ’ฏ

midnight steeple
#

I have a few ideas already ๐Ÿ˜‚

#

Not sure how possible it is cause integrating native code with JS and React has always been an issue

#

But I would try ๐Ÿ˜„

zenith pulsar
#

๐Ÿซก hats off to you loads of dedication

idle valley
#

React Native is the hard part ๐Ÿ˜ฌ

#

Expo has announced they wanted to evolve to something primitive based. Who knows... maybe something to watch?

#

Their router v3 looks like Remix ft Next. They plan something for their router v4.
https://youtu.be/qsRI8T5V99g?si=eGQ7swK52hS2TGPa

In this episode, Simon interviews Evan Bacon, the creator of Expo Router. They explore the features and benefits of Expo Router, including file-based routing, deep linking, and automatic TypeScript. Evan shares the roadmap for Expo Router version 4, which aims to unify the server-client connection and introduce server components. They also touch...

โ–ถ Play video
#

Then they'll discuss the v4 road map which aims to unify the server-client connection and introduce server components. They also touch on the future of Expo Web and its separation from the core native platform.

midnight steeple
#

Yeah, saw the part of their file based routing too. Are they free @idle valley? That would mean hopefully less work

idle valley
#

I think all is open source. Even their build server (with some limitations)

#

New pricing is also... well they have to earn money. Looks like Vercel for native app ๐Ÿ˜‡

#

The benefits they provide is great, so, I would be happy to subscribe again.

midnight steeple
#

๐Ÿค” hmmm. Would check them out and more this week

#

What apple did isn't cool allthethings

idle valley
#

Shopify should buy expo. Problem solved

smoky fossil
#

Rename Remix to React Router Server and Expo to React Router App.

midnight steeple
#

That would be a monopoly ๐Ÿ˜‚

#

People already love remix for the web. Imagine a remix dedicated to native? Shopify would just be the new Meta

#

If they make that move, remind me to buy more Shopify shares ๐Ÿ”ฅ

idle valley
#

EU is watching you ๐Ÿ˜‚๐Ÿ˜‚

smoky fossil
#

Would this count as Insider Trading? Asking for a friend.

midnight steeple
#

Obviously not ๐Ÿ˜‚. It's called having a good lunch ๐Ÿคฃ

modest holly
#

he is a badassx eng

#

such sharp engs are so motivating

idle valley
#

Will try https://www.pwabuilder.com/ and report back (if my client is ok to continue my mission ........)

idle valley
#

It builds and starts, with safearea padding issues. I'm not able to test on physical device (no Apple developer paid account yet).
So I don't know for push notifications (pwa builder implements Firebase notifications)

idle valley
#

My innovative new app: a Remix PWA ๐Ÿ˜‚

idle valley
#

Push notifications (iOS) require an extra work :/

#

It requires a bridge swift <> wrapped PWA and using Firebase FCM (the most used in examples). Not an easy conversion (I'm using web push, so maybe I can opt for FCM)

midnight steeple
#

๐Ÿ‘

idle valley
#

My client is not sure about that. But I have already lost 99โ‚ฌ lol so I can try and share it on GitHub if I make something that work with Remix PWA ๐Ÿคทโ€โ™‚๏ธ

lone solar
#

how you feeling about Vite in the current @dev version of remix-pwa, @midnight steeple? everything seems to be working for me, thinking I'm just gonna ship ๐Ÿ™‚

midnight steeple
#

That's why I've been silent

lone solar
#

all good, enjoy your downtime!

modest holly
#

seems like good news

#

?

idle valley
#

seems like lol but I already have lost my job 2 days ago xD

umbral willow
#

Is v3 running on Vite?

midnight steeple
#

v3 nightly supports vite, yes

limber escarp
midnight steeple
#

Still have a lot of work to do regarding vite but haven't got time atm.

#

And Remix PWA has a few ups over vite pwa plugin like workerLoader and workerAction

midnight steeple
#

๐Ÿ‘€

midnight steeple
#

๐Ÿ‘€

rain dragon
midnight steeple
#

๐Ÿ˜Œ Making great progress. Hoping to reduce release bugs before v4 ๐Ÿ‘€

midnight steeple
#

The last few steps...

midnight steeple
#

Still wrapping up the docs, taking longer than expected but hopefully would be ready for deployment and release before 2 weeks elapses. Spoiler ๐Ÿ‘€

idle valley
midnight steeple
# idle valley https://github.com/vite-pwa/remix/tree/v0.0.1 ๐Ÿค”

Seen the project. It is an interesting one, vite-pwa is heavily workbox (which I don't mind and also haven't figured out runtime-wise). Very different from remix-pwa yet similar. Speaking of which, one more page left before the whole doc is done ๐Ÿฅณ (EnhancedCache). Another spoiler

#

This update should be bringing in a few stuffs. A new CLI, swappable runtimes ๐Ÿ‘€, no more esbuild (now vite ๐Ÿ’ฏ) - much smaller and compact packages. And a whole lot of utilities! Plus much more I won't say ๐Ÿคซ

midnight steeple
modest holly
#

nice

#

glad that one already exists

idle valley
#

The worst that can happen is to have 2 libs for the (exact) same thing ๐Ÿ˜…

midnight steeple
#

My back hurts ๐Ÿ˜‚. These docs were wicked

midnight steeple
#

Planning on releasing the docs before the packages. So hopefully, release in a week?

midnight steeple
#

Packages to be released soon โค๏ธ! Docs are designed incrementally this time, so animations and more colors would be rolling out later ๐Ÿ‘

midnight steeple
#

People really downloaded an undocumented, unfounded and mysterious package ๐Ÿ‘€

#

Remix PWA v4 has been released ๐ŸŽ‰

sturdy swallow
midnight steeple
#

Ah, okay. That's why

#

Weird tho

sturdy swallow
#

yeah that's how I got my first npm package to 1k downloads, then I realized it wasn't real users ๐Ÿ˜ฆ

midnight steeple
#

Remix PWA v4 includes:

  • New vite plugin: No more esbuild, just one plugin and all your needs are taken care of.
  • Overhaul of the sw package: A partial re-write. Now smaller, treeshaking is even better and ships with a lot more utilities
  • Worker-runtime has been upgraded to vite
  • Swappable runtimes: Change the entire behaviour of your application with one script ๐Ÿ˜. The docs finally explains what runtimes are, and you get to build a simple one too
  • Cache API overhaul: They now work in tandem with remix client route modules. Less abstraction, more supercharging
  • client package has recieved a massive buff. With a lot of new hooks and utilities, building should be much easier
  • Deprecated cache and strategy

That's the major breaking changes/features I recall. Check the docs for a full rundown. This version is being released incrementally (more iteration) btw, meaning I would be processing requests and issues much faster.

lone solar
#

Congrats on shipping v4 @midnight steeple! ๐ŸŽ‰ Been reading through the docs, but is there an example anywhere of a simple entry.worker.ts that just caches documents and assets with reasonable defaults? My head is swimming from all the options when it comes to configuring it myself. ๐Ÿ˜… I can go through it slower and try to make informed decisions for each option, but was hoping for something more drop-in that would work for your typical Remix app (while all the options would be available to tweak for your more advanced use cases).

midnight steeple
#

I would also note that regarding assets, remix PWA doesn't have an explicit way of managing them yet. Assets in production are easy to access, but in development, due to the way assets are discovered, I would have to figure it out.

#

But I have a few ideas on how to tackle it, I would be trying them soon enough

lone solar
#

Ah, okay - sounds like I should just wait a bit then. ๐Ÿ˜

sick moon
midnight steeple
midnight steeple
#

@sick moon you are vite-plugin-pwa creator, right?

sick moon
#

Yes

midnight steeple
#

Love your work vite!

sick moon
#

RemixPWA has offline support?

midnight steeple
#

Yeah

sick moon
#

Vite pwa has some problems when ssr enabled, i have no idea how to solve that problem, rn getting the index route source file and calcularing the hash for the revision

#

(Precaching)

#

Rn remix can only work as spa or ssr app, there is no hybrid mode and ssg (full or partial)

midnight steeple
#

With regards to preaching, Remix PWA hasn't been able to solve it yet. For precaching to work, the service worker should have access to the assets (scripts, stylesheets, etc.) as well as document and server data (loaders). It's easy to get the document and loader data, but getting access to assets is something I haven't figured out. If you attempt to precahe without assets, the app would work. But stuffs like styles and animations, etc. would be missing.

Vite pwa has some problems when ssr enabled, i have no idea how to solve that problem

Do you mean caching during SSR, or precaching during SSR?

sick moon
#

Peecaching

#

Pwa plugin will allow use network only or network first with cache support (spa or ssr or api calls)

#

You can check the sw vite plugin

#

It exposes the routes

#

You can enable vite manifest to get the client assets and expose them

#

You will need to use a remix preset

#

The preset will expose the routes

#

Check also the sw folder

#

You can use fast glob or similar with a vite plugin to traverse client output folder

midnight steeple
sick moon
#

With Vite you need the lifecycle of both , vite and remix: remix plugin will run another internal vite build

#

Check this repo:

midnight steeple
#

Realised the same. In Remix pwa case, I just used Remix plugin internally and used it's lifecycle instead of the lifecycle of both

#

Cause remix created a child Vite dev server which is dependent on Vite itself

sick moon
#

If you want precaching client assets you need both

#

(Maybe not ๐Ÿ˜…)

midnight steeple
#

By client assets do you mean images, fonts, etc. Or routes and route data?

sick moon
#

Yes

#

And client assets

#

If you use ssr you will have client and server folders, inside client all client js files will be on assets subfolder (can also be precached)

#

Pwa remix plugin will include them using custom globPatterns (workbox)

midnight steeple
#

Yeah, but note that remix only build them in production. When running in dev, they aren't put in the build folder.

Would confirm tomorrow, but I think the server index.js file contains all assets as well as their revision (when building in SSR)

sick moon
#

Pwa plugin disables precaching in dev mode with devOptions enabled

midnight steeple
#

Ah, okay ๐Ÿ‘. That's what I was told to do too ๐Ÿ˜…, but I decided to not disable it in dev as that means not being able to debug precaching in dev. So I have to find a way to get asset in dev

sick moon
#

You shouldn't, dx and sw dont play well together

#

You shouldn't intercept any request in dev

#

Dev mode with pwa enabled shoild be only to test web manifest and advanced features like push notifications and web shared target api

#

Once tested it should be disabled

midnight steeple
#

๐Ÿ‘ A few users complained about that. Not being able to intercept requests in dev, as that means they can't test efficiency of their sw before pushing to prod.

I also understand that the DX of SW is quite weird especially in dev. There's no cleanup, sw might step in each other and it's a hassle to actually make them work. My approach with that (especially in Remix PWA where you write sw code in your route files) is to run sw in sandbox mode in dev and run them normally in prod.

#

That way, you minimize DX pitfalls in dev and prod works as expected

sick moon
#

The response, build + preview

#

User can intercept requests, but not precaching, you can be testing wrong app version

#

I have some issues also using msw

#

You cannot have 2 sw in the same scope

midnight steeple
midnight steeple
# sick moon You cannot have 2 sw in the same scope

Yep. That is why remix pwa has a strict one sw policy. Bundle everything into one large sw at the base dir and serve from there. If the user wants more than one sw, then they use importScript to import the different workers into one file and serve that on the base scope

sick moon
#

Pwa plugin disables precaching and offline in dev (page refresh will redirect to the offline page)

#

How do you build the sw?

#

(Maybe no build?)

midnight steeple
sick moon
#

Vite build can also do that

midnight steeple
#

It's Vite build I use.

#

Vite build uses rollup under the hood for handling the bundling part

midnight steeple
#

Something similar to this is what remix pwa does. Only that because we use route code too, it's a bit bigger

sick moon
#

You can solve this adding virtual modules in vite plugins

#

The register them also in the build

#

Reusing some code in dev and build modes

midnight steeple
sick moon
#

Nice

topaz oar
#

Is there any working example with Remix-pwa (v4) with offline support?

midnight steeple
midnight steeple
#

Doing some fixes, plus adding asset support to Remix PWA and a few things came up:

  • Might have figured this one out
  • useSWEffect now detects document refresh as well as client navigations
  • Remix PWA doesn't (fully) support Remix SPA mode. If you are using SPA mode, would recommend: https://github.com/vite-pwa/remix ๐Ÿ˜ - (you can make it work, but the absence of a Node server & server loaders and actions means it doesn't offer much advantages compared to vite-pwa)
    Would update the docs to reflect these changes and anymore I make, dropping this in the meantime for review ๐Ÿ‘. The guides are still coming as planned
GitHub

Zero-config PWA Plugin for Remix. Contribute to vite-pwa/remix development by creating an account on GitHub.

sick moon
#

@midnight steeple Just to tell you that it was not my intention to be the competition, I saw that it was easy to add the integration in vite pwa org. and I didn't check remix plugins, I didn't know about the existence of remix pwa until I saw the tweet

#

I added support for iles and contributing in qwik dev pwa and serwist gh repos

#

If you need help to integrate pwa assets generator ping me here

midnight steeple
# sick moon <@735454326343860344> Just to tell you that it was not my intention to be the co...

Not at all ๐Ÿ˜„. Whilst solving the assets issue, I decided to run the tests against Remix in SPA mode and it was not pretty. I had to make heavy edits to make it work, after looking at how I built Remix PWA, it wasn't planned to support SPA (anytime soon). And I used vite-pwa as an inspiration ๐Ÿซฃ (for example, the context resolver plugin: https://github.com/remix-pwa/monorepo/blob/main/packages/dev/src/plugins/main.ts is heavily inspired from how you created a global context), so it felt right to just leave SPA for now since you have a working solution ๐Ÿ™‚

GitHub

Remix PWA v4. Contribute to remix-pwa/monorepo development by creating an account on GitHub.

sick moon
#

Uhmm, you are talking about the assets, I was talkibg about generating all pwa icons and inject then in the web manifest on the fly

#

Check pwa-assets example

midnight steeple
#

Oh, my bad ๐Ÿ˜…

sick moon
#

Also html favicon, pwa icons and theme-color via virtual (in dev server and build time)

#

Ofc ppl can use the pwa assets generator cli

midnight steeple
#

Just checked it out ๐Ÿ’ฏ. I would probably just build on top of what you have and introduce manifest injection, if u don't mind ๐Ÿ‘
Though, you generate yours on the fly via the plugin, Remix PWA generates it's own on the fly via resource routes or a static manifest json file.

sick moon
#

You can copy/paste the code in the src/pwa-assets folder from vite-plugin-pwa (adding the pwa assets generator as opcional peer and devDep, check the package.json)

#

Once you have that logic you only need to create your vite plugins

#

Check also the ctx and how it is initialized (in the main plugin), maybe you can also copy/paste the pwa-assets plugin

#

Since you dont use transformIndexHtml (missing html entry point), you can also remove the hooks

#

(Vite hooks)

#

Vite pwa plugin doesn't support static web manifest injection

#

You can disable the manifest and put it in the public folder, the pwa plugin will not work

#

You only need to get the static web manifest (adding the name/path to it in some confguration optio ) and the code in the pwa-assets should work (just a few changes in the corresponding remix pwa plugin)

#

Beware with Vite, will copy public folder after build finish, can be a problem

midnight steeple
#

The cookbook looks great ๐Ÿ”ฅ

sick moon
#

You should add also self destroying sw

midnight steeple
midnight steeple
#

I was thinking of a mobile note app, it would be tailored to just small screens. That way, being able to showcase extra features like installability, publishing to app stores (APKs, etc.)
The downside is that it won't be presentable on large screens
The upside is the workings would stay the same, the only thing that would need to change is designing a new layout

#

cc @lone solar ๐Ÿ˜…. Would love your input too. That way, the guide is just the right size for everyone

topaz oar
#

epic stack offline version?

midnight steeple
#

Done chefkiss

lone solar
# midnight steeple cc <@344545403217379328> ๐Ÿ˜…. Would love your input too. That way, the guide is j...

Not sure I have much value to add here. In some of my Vite apps (prior to Remix), I'd just install vite-pwa and trust its zero-config "Sensible built-in default configs for common use cases" to behave as advertised with regards to caching/offline stuff. ๐Ÿ˜… I'd like to see the simplest possible setup that gets us installability and some basic caching with knobs to turn when necessary.

midnight steeple
midnight steeple
#

Just saw I missed a bonus section out by mistake: sw update prompt. Would fill that in when I wake up ๐Ÿ‘

modest holly
#

@midnight steeple

#

how is it looking

#

i havent taken a look

#

is it production ready, are people using it?

midnight steeple
midnight steeple
#

I have deleted @remix-pwa/push package from the remix-pwa registry, because I am creating a new push package and the workflow I use doesn't allow for continuing versions from random spots. The old push package should still be installable via github, but a new one is underway. Hopefully, would be out soon too

frank moon
#

I am using it for piqy, a pickup display monitor software. Numerous large food franchises in Germany use it.

midnight steeple
#

chefkiss wow! I'm so glad it is useful for so many people. Drives me to make it much better for everyone

midnight steeple
#

New update dropped for further control over service worker lifecycles - creating an update system within your PWA just got possible. Used it to create a very simple update prompt in my epic stack example: https://remix-pwa.run/docs/main/offline#service-worker-update

Packages affected: @remix-pwa/sw, @remix-pwa/client

The home of Remix PWA. A PWA Framework that redefines web experiences.

#

Plus usePWAManager hook got an upgrade, a new message handler dropped for fine-grained control over sw waiting cycle and a few utilities within the sw package ๐Ÿ‘

#

Also, re-published the old push package under the namespace: @remix-pwa/old-push. The @remix-pwa/push name is reserved for the incoming package

midnight steeple
#

๐Ÿ‘€

modest holly
#

wow

#

๐Ÿ”ฅ

midnight steeple
#

New hook, few utilities and tweaks all over in the latest releases. The CLI should be getting a new publish soon, I've added a new command: update. To allow for easy upgrades chefkiss
That and npm workspaces is giving the push package an issue

modest holly
#

๐Ÿ”ฅ

midnight steeple
#

Btw, looking for co-maintainers for remix pwa ๐Ÿ™ƒ. If anyone feels they are up to it and want to, you can holler. That includes access to the docs as well ๐Ÿคง

#

Just realised I hadn't published [email protected] yet so just publishing ๐ŸŽ‰!
The new addition is the update (alias: upgrade) command. Allows you to easily update all @remix-pwa/* or select packages to the latest. This problem is annoying to me, when I need to update dev and some other dependencies and need to run two different commands for --save-dev and --save, with the update command, you can do:

# upgrade all @remix-pwa/* package that exist
npx remix-pwa update|upgrade

And to upgrade select packages, do (via the --packages/-p flag):

# update just @remix-pwa/dev and @remix-pwa/sw
npx remix-pwa update -p dev sw

There is also a -r flag for pointing to the root. Useful in a monorepo, by default it is process.cwd():

npx remix-pwa upgrade -p sw -r ./app/remix-app

Note that both flags are not compulsory. Defaults to all packages and process.cwd()

#

Would update docs later

#

Btw, all @remix-pwa/* packages are supported. As long as it is available via npm

pale bone
#

Any step by step with no step skipped tutorial on implementing remix pwa in an existing remix app. I successfully switched to vite but cannot wrap my head around the pwa part. Any leads will be appreciated.

midnight steeple
pale bone
misty fractal
midnight steeple
# misty fractal There's an official Vite PWA plugin now for remix, any quick summary of what's d...

In short, Remix PWA is suited for SSR use-cases, whilst Vite PWA is suited for both. Remix PWA also provides solution for more than just service worker and manifest: background sync, push, and various utilities to assist with Remix APIs
The main difference between them in SSR apps is that Remix PWA provides more utilities tailored towards service-worker-as-a-server which boosts its customisation and capabilities without much complexity overhead.
Regarding philosophies, Vite PWA builds itself on Vite and then extends itself towards Remix. Remix PWA is built on Vite to specifically leverage the Remix vite plugin & server
Can you use them together? Yes, I suppose. But it won't be worth it. Both are built to be standalone sw plugins with their own pros and drawbacks ๐Ÿ˜
Fun fact, the creator of vite pwa is in this post ๐Ÿซฃ

midnight steeple
#

Published the CLI updates

#

Docs for push also in progress

sick moon
#

@vite-pwa/remix is not official, when I started doing it I didn't look to see if there was any existing solution for Remix, someone on Twitter asked me if I knew Remix PWA after I published my plugin.

#

I would have saved myself a lot of work with some contribution to the Remix PWA.

#

(As soon as I have free time I will see if I send a PR to include @vite-pwa/assets-generator in Remix PWA)

midnight steeple
sick moon
#

anyone using module resolution node (node10) ๐Ÿ˜ฌ

#

the fix should be easy, add client in the paths

midnight steeple
#

The module & module resolution was set to NodeNext for this one

#

And the paths were just import

sick moon
#

anyone consuming the package with node10...

#

should be dist/client/

midnight steeple
#

Would need to update to import and require

sick moon
#

the paths are wrong

#

main and types in package.json

#

you should use node as the default

midnight steeple
#

Just realised. Thanks for pointing it out. I copied over the package json from (I think the dev package)

midnight steeple
sick moon
#

no

#

I mean, the default package

#

forgot it

#

the server subpackage is a node thing (vite plugin?) => use . as the default => node

#

you're using the client as the default

#

you can also check this repo, ESM for workbox without generateSW module in workbox-build

#

ESM only

#

(it is about the workbox-runtime in Remix PWA)

midnight steeple
midnight steeple
# sick moon

Please what site is this? I want to re-run the patches

sick moon
#

you can also use it from local

#

I also use publint

#

can also be used from commandline

sick moon
midnight steeple
sick moon
#

check details at the bottom

#

entrypoints

#

you should use typesVersions to redirect the default entry (I suggest you to remove/change the output folder, don't add server subpackage, use it as default)

#

(I didn't check the code, I guess server is the vite plugin/remix integration)

midnight steeple
sick moon
#

you also need to use typesVersions to redirect client and use-push subpackage exports

#
"typesVersions": {
    "*": {
      "client": [
        "./dist/client/index.d.ts"
      ],
      "use-push": [
        "./dist/client/hooks/index.d.ts"
      ]
    }
  }
#

add the entry between exports and files

#

upps, I'm using the package.json in dev/push branch

#

it seems the published version doesn't have use-push

#

it is hook

midnight steeple
#

Yep, I am yet to do that. Lemme open the PR

midnight steeple
#

Was creating some new utilites

midnight steeple
sick moon
#

nice

midnight steeple
#

Thanks a lot

sick moon
#

I'll check all remix pwa packages

#

(in main)

#

client needs typesVersions for client/utils and client/hooks

#

the fix is the same

midnight steeple
#

Yup, as well as sw. Would create a fix branch to fix all that

sick moon
#

ok

midnight steeple
#

Pushed @remix-pwa/push to main!
Docs now available via: https://remix-pwa.run/docs/main/push-api. Lemme know if the docs need further clarification, I would be creating more resources as time goes by
cc @idle valley

sick moon
#

how about @remix-pwa/dev? there is no exports entry and a lot of subpackages there

#

do you want all subpackages exports?

#

rn only default + dist

#

why search not working in FF and chrome (docs)?

#

(Windows laptop)

midnight steeple
sick moon
#

ohh, ok

midnight steeple
sick moon
#

I'll add also the default package export to all package.json

#

strategy package seems to be missing/excluded from root build

midnight steeple
#

Deleted it in the fixes branch - it is deprecated. As well as cache

sick moon
sick moon
#

the types using ./types

#

use always types + default

#

in that order

#

(it is a suggestion from publint, also including subpackage exports)

#

(running npx publint in package folder)

#

upps

#

what's wrong with my PR?

#

I've only touch package.json files

midnight steeple
midnight steeple
midnight steeple
sick moon
#

oh, I run npm install, lock file modified, I just revert the change

#

I cannot resolve conflicts in the PR (cache and strategy package.json files)

#

just added the exports

midnight steeple
#

Might need to re-pull main.

#

Since I deleted the cache and strategy. Thats a huge code chunk

sick moon
#

ok

#

upps, so I need to use dev branch

midnight steeple
#

Yeah ๐Ÿ‘

#

any branch > dev > main
gh actions take care of the releasing and versioning

midnight steeple
#

Just getting back from my martial arts class, would take a look ty

midnight steeple
pale bone
#

Is remix-pwa production ready?

misty fractal
pale bone
#

I need to implement it in my application, but i haven't come across a well thought out tutorial. You have leads to an article about it @misty fractal ? I see the official documentation explains components of the library. Not how to go about it.

misty fractal
#

I don't know one off hand unfortunately

misty fractal
# pale bone I need to implement it in my application, but i haven't come across a well thoug...

This is an integration of Remix PWA with the Epic Stack, which you could use for a project or check the last two commits where the integration happened https://github.com/ShafSpecs/offline-epic-stack

GitHub

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea. - ShafSpecs/offline-epic-stack

midnight steeple
midnight steeple
#

Still nowhere near done, it is much longer than I expected ๐Ÿคง. This is hopefully going to turn out epic - sorry for the extra wait

midnight steeple
#

Major @remix-pwa/[email protected] release just dropped.
Complete overhaul of syncing and queueing in Remix PWA + added logging support for better developer experience.

Temporarily taken down the background sync guide. Should be up later this week (or next week ๐Ÿคง) with up-to-date content.

exotic swift
#

Is there a fix coming for this? Using latest remix version and latest node version:

#

Fixed on my end by editing the import to what the error message told me to do

exotic swift
#

Does anyone have any idea how to handle opaque responses within the service worker? I have been stuck on trying to get discord auth to work with remix-pwa and caching. Any help will be appreciated

#

This is what I've been trying to fix:

midnight steeple
midnight steeple
exotic swift
#

Yeah, I just decided to take out the cache in service worker, too advanced for me lol

midnight steeple
#

It would be just as you patched it, run patch package to save the changes and go about your day

#

Won't be able to ship a fix for a few hours. I'm exhausted

exotic swift
#

No problem at all

exotic swift
#

Yeah seems to only work when I unregister the service worker :/

#

I wonder if itโ€™s just with remix-auth-discord? Iโ€™m going to try some other methods and see if it still happens

exotic swift
#

Yeah it's with all strategies, even the magic link email authentication

midnight steeple
#

So the strategy skips them

midnight steeple
#

You shouldn't be caching auth routes (most of the times) anyway

pale bone
midnight steeple
#

Anyone successfully integrated Algolia into their site? It seems broken with Vite and is delaying the next doc update

#

Docsearch React, I mean ๐Ÿ‘

midnight steeple
fleet niche
#

Potentially very silly question about this project: would this be compatible with a project running in "SPA mode"?

midnight steeple
#

By implementing a "No cache" policy out of the box, opaque responses are always discarded. Would implement an opt in later in the future

midnight steeple
pale bone
exotic swift
pale bone
#

I keep getting the below error whenever i run the npx remix-pwa <...> commands

exotic swift
#

v20

#

I had the same issue on any other version except v20

pale bone
exotic swift
#

Np

midnight steeple
#

v20 and above. importing .json files got a change in v20

#

So I reverted to v20. I would add a disclaimer to the docs

pale bone
#

This error is breaking my app in production on mobile devices safari and opera browsers

Cannot read properties of undefined (reading 'getSubscription')

pale bone
midnight steeple
#

Thx for the heads up. Would look at that this weekend

midnight steeple
pale bone
midnight steeple
pale bone
# midnight steeple https://github.com/remix-pwa/monorepo/blob/f7e84212d57337b96dc0d8a0b4065e5210286...

No

https://github.com/remix-pwa/monorepo/blob/f7e84212d57337b96dc0d8a0b4065e5210286f72/packages/push/client/hook/usePush.ts#L148

As this is in the useEffect, i suspect it might be the culprit. Perhaps checking the pushManager too in the if statement would fix the break.

GitHub

Remix PWA v4. Contribute to remix-pwa/monorepo development by creating an account on GitHub.

midnight steeple
#

It's weird. Because if you have a service worker registration object, the push manager must be present too

pale bone
#

@midnight steeple can you have a push notifications walk through. Am stack specifically on the subscribeToPush success callback. I need to have this payload to my backend.

pale bone
midnight steeple
#

Sorry for a lack of response. I'm currently traveling out of the country and I'm not working atm. I should be back home this coming week tho ๐Ÿ‘

royal saffron
#

I have @pale bone, and planning to publish a walk through soon. What are you stuck on?

pale bone
royal saffron
#

That makes sense

#

The backend should have a subscription store, with an endpoint for storing a users subscriptions and getting them all back, as well as deleting a subscription when a user unsubscribes or you find a subscription doesnโ€™t work anymore

#

Then when you attempt to notify all of s users subscriptions you should catch errors and delete the dead ones

#

Does that make sense?

#

It was really confusing the first time I did it

#

The backend is the most under documented part of web push

#

Thatโ€™s what Iโ€™m planning to write about

pale bone
#

That makes sense. Well, i already have a table to persist the subscription data. How this notifications get to the client is where am stuck. I have firebase in my backend, already set up to send the notifications but i don't know if it is really needed...

pale bone
royal saffron
#

The service worker sends the notification

pale bone
royal saffron
#

On the backend, when something happens that you want to notify a user about, you ping the subscription (I use the webpush library from npm). That hits a server maintained by each browser vendor. Then the browser sends that event to your service worker. Then in the service worker you bind to that event and inside that event callback you can send a notification to the browser.

#

Does that make sense?

pale bone
royal saffron
#

I donโ€™t think firebase is needed, no.

exotic swift
#

The service worker is what listens for the notifications on the device, if youโ€™re having issues with the user receiving them, it might be an issue with the service worker or your keys might not match the subscription endpoint. If youโ€™re having trouble with actually getting the subscription from the user, try your code on a secure protocol, some browsers donโ€™t allow it to work on localhost or http connections

#

And for the backend, on whatever endpoint you end up using to receive the subscription, you should encrypt it, and store it in your database, and then when you need to send a notification from your backend, decrypt it and send it with the web-push library

midnight steeple
pale bone
pale bone
exotic swift
#

Or is getSubscription in the library?

#

I canโ€™t remember well

pale bone
midnight steeple
pale bone
royal saffron
#

The full stack web push guide I was talking about is up at https://bocoup.com/blog/full-stack-web-push-api-guide. Thanks to @midnight steeple for the review. Even though this post talks about a non-remix-pwa implementation (since it was written prior to the latest remix-pwa release) the guidance is likely still helpful.

midnight steeple
#

Yup. It is very good
It actually helped me structure the push package ๐Ÿ˜

clever drum
#

I'm interested in incorporating Remix PWA into my B2B SaaS. I haven't done a PWA before. I want to know if this will support multiple PWAs in the same Remix app? Depending on the route the user is on, I'd like it to install one of three envisioned PWAs. Thanks!

midnight steeple
#

I would check how possible that is this coming week. I should work on Remix pwa related stuffs this week

pale bone
#

Push notifications only received when the app is active. Anyone experienced this? It seems the sw is activated when the app is active and vice versa.

pale bone
# pale bone Push notifications only received when the app is active. Anyone experienced this...

This post pointed me in the right direction. I had battery saver activated on my device preventing background taskslolsob https://stackoverflow.com/questions/73222123/push-api-mobile-browsers-dont-receive-push-notifications-anytime-only-when-sw

midnight steeple
pale bone
#

defaultFetchHandler breaks app with Failed to fetch error after the pwa is inactive for a long time eg 24hrs. This happens when i open the app after the inactivity and try navigating away from the current page. The above error is due to network issues but on refreshing the app, it works as expected. Is there a fix for the break? ATM i have an errorboundary that takes care of the break, but i find it bad UX.

midnight steeple
#

What does your default fetch handler look like?

pale bone
# midnight steeple <@1158065363775389776> https://shafspecs.hashnode.dev/remix-pwa-practical-guide ...

`export const defaultFetchHandler = ({ context }: WorkerDataFunctionArgs) => {
const { request } = context.event;
const url = new URL(request.url);

if (isDocumentRequest(request)) {
return documentCache.handleRequest(request);
}

if (isLoaderRequest(request)) {
return dataCache.handleRequest(request);
}

if (self.__workerManifest.assets.includes(url.pathname)) {
return assetCache.handleRequest(request);
}

return fetch(request);
};`

Just as it is in the tutorial

pale bone
midnight steeple
#

I can guess. Browsers generally pause the service worker to conserve battery, it should not fail though

pale bone
pale bone
midnight steeple
#

Okay allthethings

Btw, I'm looking for a co-maintainer for Remix PWA. I work more in the robotics/aerospace industry nowadays, and haven't been able to keep up with the remix/web world

pale bone
misty fractal
midnight steeple
misty fractal
#

retweeted

clever drum
#

Would I be able to use Remix PWA to have a PWA that downloads videos from my site and plays them locally? What's the limitation on storage size?

midnight steeple
#

Remix PWA allows you to provide artificial limit, so that you can provide some semblance of control

#

Using the browser File API, you can choose to download the video directly onto the device. That way it remains permanent

#

Instead of caching temporarily. A case study for Caching of media files is https://soundcloud.com. When you stream a track, it doesn't download it, it caches it for a certain time (I think a week?). So if you replay a track without internet, it works. But if you attempt to shuffle or play something else, it just buffers (load) forever.

SoundCloud

Discover and play over 320 million music tracks. Join the worldโ€™s largest online community of artists, bands, DJs, and audio creators.

#

Just reread your question, you can download normally like on any normal site, and use the file api: https://developer.mozilla.org/en-US/docs/Web/API/File_API to access the files. Note that for security reasons, you won't have free access to the file system without the user input. So you might still implement a little bit of caching depending on use case

MDN Web Docs

The File API enables web applications to access files and their contents.

maiden thunder
#

Does it easy to integrate with Magento backend as Pwa-studio?

midnight steeple
midnight steeple
#

Hello ๐Ÿ‘‹! Been working a lot on Remix PWA lately and some new features got released:

  • buildVariables: Allows you to inject build/environment variables directly into your service worker. Commit - Link
  • Added matchOptions to cache strategy. Allowing you to further customise cache behaviour. Commit - Link
  • Working on a pre-RC for Remix PWA SPA Mode (still WiP). This would change the behaviour of workerLoader/Action in an SPA application. Also mapping out a new API for them.
  • Added a --dev/-D flag to remix-pwa CLI to allow updates to the latest dev releases. Commit - Link

I am also working on a few more surprises. Thx โœŒ๏ธ

clever drum
#

@midnight steeple I just wanted to extend my gratitude. Remix PWA has fundamentally changed my professional approach to apps. I had made a conscious decision to circumvent the mobile app space after the kludge that was React Native. I had some projects from 2016-2020 that used RN and it was a meager dev experience and even more so on the support front. I have always wanted some of the benefits that mobile apps had over traditional web apps. PWA bridges that gap and now it is much easier for the user to install the app on their home screen. I wish we had a button to click to install but that seems only to work on my desktop in contrast to my iPhone. Thank you for this project and helping me arrive at new level to what I can achieve digitally. Remix PWA makes it cleanly approachable in the distinct form and fashion of Remix. This cohesiveness makes it so easy to be incredibly productive in the PWA space.

tame harbor
midnight steeple
tame harbor
midnight steeple
#

Hello ๐Ÿ‘‹! Been working on the next major version of Remix PWA and I want to announce the first rc PR and issue which allows you to track the progress. The PR lists the major changes being made and I opened an issue to collect feedback as well as suggestions.

The docs should also be getting a next tag that would discuss the version in detail. v5 won't be releasing anytime soon though. Some of the major changes include:

  • a new manifest package. This includes interpolation with Vite PWA plugin for manifest generation
  • Support for single fetch and SPA mode. I've made some breaking changes to how worker loaders & actions behave. They would now act as loaders & actions in SPA mode and are disabled in single fetch
  • Adding a new scaffold command to get a new Remix application from the ground up with Remix PWA already installed (still planning out a CLI for this)
  • Introducing a few new components
  • Incremental support for Remix (Or RR atp) v7
GitHub

This PR aims to introduce the first release candidate (rc) of Remix PWA v5 - the next major version.
Includes a lot of breaking changes and packages.
@remix-pwa/dev

Support added for Remix SPA mod...

GitHub

This issue is meant to closely track #269 An issue for discussion, allowing for suggestion, reports as well as requests for the next major version of Remix PWA. The PR would be listing the major ch...

#

I have currenty pushed changes made to dev package only dev and worker-runtime pakages. More to follow in the coming days ๐Ÿ‘

stiff slate
#

Hello everyone, I'm facing a small problem with linking the manifest file correctly.
When I use the <ManifestLink/> component the browser don't detect the manifest file, but when I use the below link; everything works fine, is there any thing I'm missing?
<link rel='manifest' href='/manifest.webmanifest'></link>

midnight steeple
#

Via the manifesturl prop

#

This issue is being worked on for the next version

stiff slate
#

where did the messageHandler came from?

import { SkipWaitHandler } from '@remix-pwa/sw'

// rest of the service worker

const skipHandler = new SkipWaitHandler()

self.addEventListener('message', (event: ExtendableMessageEvent) => {
  event.waitUntil(Promise.all([
    messageHandler.handleMessage(event),
    skipHandler.handleMessage(event),
  ]))
})
midnight steeple
#

As well as separate unnecessary code

midnight steeple
#

Yeah, that guide needs some edits ๐Ÿ˜…

stiff slate
stiff slate
midnight steeple
#

No, initially I aimed to support it. But workbox became partially deprecated, and I chose to forego it.

midnight steeple
#

Which takes a lot from Workbox, but we don't support Serwist either

stiff slate
#

So if I'm using remix-pwa; I can't use serwist neither workbox?

midnight steeple
#

Yeah

midnight steeple
#

Their methods are so different, and it would be redundant. I advise one or the other

limber escarp
midnight steeple
#

First Remix PWA v5 candidate released!
To utilise it, you would require the @dev tag to install. Docs aren't available yet, but the major changes in the first changes already shipped are can be found in this PR description: https://github.com/remix-pwa/monorepo/pull/269
You can ask me any question that arises

GitHub

This PR aims to introduce the first release candidate (rc) of Remix PWA v5 - the next major version.
Includes a lot of breaking changes and packages.
@remix-pwa/dev

Support added for Remix SPA mod...

#

The second stage should include an updated remix-pwa CLI.

zealous python
#

is there some current workaround for using rel="manifest" instead of rel="webmanifest"? the entire package is broken / doesn't register a PWA for me unless i go and edit ManifestLink to use manifest instead of webmanifest

#

i see it is part of v5, but what's today's solution @midnight steeple

#

nvm, i see above a workaround is just to use <link rel="manifest" href="/manifest.webmanifest" />

zealous python
#

with dummy service worker from docs it seems

#

after a while the entry.worker.js fails to fetch and the site doesn't load. fails on this:

const defaultHandler = entry.module.defaultFetchHandler || ((event) => fetch(event.request.clone()));
midnight steeple
zealous python
#

using this:

/// <reference lib="WebWorker" />

export {};

declare let self: ServiceWorkerGlobalScope;

self.addEventListener("install", (event) => {
  console.log("Service worker installed");

  event.waitUntil(self.skipWaiting());
});

self.addEventListener("activate", (event) => {
  console.log("Service worker activated");

  event.waitUntil(self.clients.claim());
});

it breaks my localhost after a while, can't navigate around at all. clearing storage in application tab doesn't seem to work after a while

midnight steeple
zealous python
#

ah, unfortunately it is a big codebase so probably not, i may just go run with vite pwa because i'm not really sure where to start with troubleshooting this

#

it seems to just be a localhost problem? deploying to a staging branch seems to not encounter this issue, but it requires me to restart localhost every time i save a file? maybe entry workers is being rebuilt or not probably unmounted

midnight steeple
#

When a rebuild happens, the browser takes care of it automatically. I would try and debug on my end, but this is probably fixed in v5, weird.

zealous python
#

when is v5 prospected to release?

midnight steeple
#

Should be next month hopefully

zealous python
#

it seems to be fixed with v5 ๐Ÿ‘ thank you for all your hard work @midnight steeple!

zealous python
#

hmm i spoke too soon ๐Ÿ˜†

#

must manifest[.webmanifest].ts read process.env for setting the start_url?

#

the site works fine but then after a while it freezes up and i get these errors in console

midnight steeple
midnight steeple
lone solar
#

Hmm, what's the PWA story now that we're supposed to "upgrade" from Remix to RRv7? ๐Ÿค” (Remix PWA depends on @remix-run packages)

midnight steeple
#

I would have to start working on a v5.1 soon. It won't be different user-wise, but would require some major tweaks ๐Ÿ‘

lone solar
#

I wonder if we could use Vite PWA in the meantime or if it's still rather unsuitable for RRv7 as it was for Remix

#

(not trying to drive people to another solution, just trying to buy you some time ๐Ÿ˜… )

orchid falcon
#

Hey! Just upgraded my remix app to react-router v7 and came hunting for some news on remix-pwa. Thx for the efforts here.

midnight steeple
#

I also don't mind pushing Vite PWA. Joaquin and I are good, plus they aren't exactly the same library with extra features ๐Ÿ‘

midnight steeple
lone solar
old forge
#

Hello guys! I have a question... How can I update the cache in my app using @remix-pwa/sw? When I change the cache version and add new components or make changes, they are not reflected after deploying my app. How can I fix this? Any help would be greatly appreciated. ๐Ÿ™

more context: https://github.com/orgs/remix-pwa/discussions/159

orchid falcon
analog jolt
#

If I understand correctly, for new projects it is not advisable to utilize remix-pwa given the release of RR7? But to consider vite-pwa?

midnight steeple
#

But if I recall correctly, rr7 is like Remix spa mode (not sure). Which the next version is supporting

analog jolt
#

I ask because the remix app is giving me all sorts of signs to move to RR7 via future flag:
e.g, v3_lazyRouteDiscovery, v3_singleFetch, and I'm wondering if any of this will play nicely with remix-pwa

misty fractal
#

the rr7 vite plugin has SPA mode but it also has the rest of remix. Remix has fully moved into RR via the vite plugin

midnight steeple
#

Update: I've finally started rolling out the new docs: https://remix-pwa.run/docs/next/quick-start
v5 would probably remain in dev for a while as I try to figure out how to approach RRv7, but you can use it in your remix applications

The home of Remix PWA. A PWA Framework that redefines web experiences.

#

RRv7 is by default, single fetch mode. @misty fractal just to clarify pls, that means all clientLoaders and actions are all called at once, right? Not the waterfall effect of Remix (one after the other)

#

Remix PWA now behaves differently in single fetch mode and spa mode as well, single fetch disables a lot of Remix PWA features, I am still thinking out a different api for that. spa mode allows your workerLoader/action to become your new loaders and actions

misty fractal
#

Remix did not waterfall either

midnight steeple
#

๐Ÿ‘‹

#

Want to announce that the main critical parts of Remix PWA supporting React Router has been completed, and that I want to begin the process of sun-setting Remix support (remix is not recieving anymore major updates, right?)
Also, do I keep the name (Remix PWA) or change it (React Router PWA)?
https://github.com/remix-pwa/monorepo/pull/287

GitHub

This change begins the process of sun-setting Remix support, and full support for React Router v7

#

Thanks for the patience ๐Ÿคง

misty fractal
#

for this project I think react router pwa makes sense

misty bough
#

@midnight steeple Is there any doc on how to run pwa locally? I followed the Quick Start guide, but after that, nothing happens when doing npm run dev.

midnight steeple
#

You would need to add it to your Vite plugins. I'm rewriting the docs to explain the steps better

#

As well as require an entry worker file

modern sleet
#

@midnight steeple Hi, is it possible at the moment to use the remix-pwa with react-router 7? Or do you need to merge the PR you linked in order to make it work?

midnight steeple
limber escarp
#

I admire how long youโ€™ve kept up maintaining this

midnight steeple
#

Name changing (from remix-pwa -> react-router-pwa) is a hellish experience

warped wind
#

maybe this seems obvious in hindsight, but we've been experiencing loss of push subscriptions when installing/activating new service workers in prod. is it best practice to unsubscribe from the old SW and then "re-subscribe" to the new SW?

#

I believe that's the cause to the bug we're seeing, trying to implement this now and see how it goes

zealous python
#

@midnight steeple i'm finally migrating to rr7, what's the process for using rr pwa?

midnight steeple
#

Nothing too different from remix pwa. React router isn't in main support yet

zenith pulsar
#

any updates @midnight steeple ?

midnight steeple
#

Nope. Honestly speaking, I thought I would do one more major update. But I work far less with web technologies nowadays, and more with metal. That said, I plan to be back in OSS next year, wether that means web or not, I'm not sure. In the meantime, Vite PWA by my good friend Joaquin is a great alternative that works

sick moon
#

the new @vite-pwa/react-router using the new @vite-pwa/unplugin-pwa and the new workbox fork using vite 8 or rlldown to build the service worker

#

@vite-pwa/unplugin-pwa becomes modular, we'll be able to create our own custom integration

#

the workbox fork supports dual service worker build with custom code splitting, SW builds run in parallel (rolldown), and the new workbox window exposing esm SW support detector via caniuse (esm syntax + type module registration)

#

to use dual service worker with the new buildSW strategy, SW must use ESM syntax

midnight steeple
#

The new Remix PWA chefkiss

#

Been so out of web dev, apologies to everyone

#

But now, we got PWA back thanks to Joaquin animated1

sick moon