Comments (29)
I Will try to add an example and include remix in the docs...
from vite-plugin-pwa.
spa pwa changes can be found here with some configuration changes: userquin/remix-pwa#1
from vite-plugin-pwa.
@xstevenyung we need a custom plugin for remix, this weekend I'll try to create it: @vite-pwa/remix
with similar logic and a few options to customize the build.
from vite-plugin-pwa.
importing virtual:pwa-info
not working? https://github.com/vite-pwa/vite-plugin-pwa/blob/main/info.d.ts
from vite-plugin-pwa.
check this sveltekit example: https://github.com/vite-pwa/sveltekit/blob/main/examples/sveltekit-ts/src/routes/%2Blayout.svelte#L6
from vite-plugin-pwa.
In case this helps, this seems to be working for me in Remix:
import { pwaInfo } from 'virtual:pwa-info';
// ....
// ....
{pwaInfo ? (
<link rel='manifest' href={pwaInfo.webManifest.href} />
) : null}
</head>
It did take me a while to figure that out though :)
from vite-plugin-pwa.
just tested out, and yes both approaches works. maybe we could document this with an example similar to the sveltekit one ?
from vite-plugin-pwa.
You can also check astro integration examples, check the default layout.
from vite-plugin-pwa.
So, remix doesn't have an html entry point, that's why the manifest cannot be injected, and so we need to add it to the layout or root tsx component/entry point.
I'm going to play with it on my local to test also custom sw in dev mode and the pwa assets generation integration.
from vite-plugin-pwa.
thanks for the quick response, happy to help if you need any assistance for this!
from vite-plugin-pwa.
like a beast, custom sw on dev server with pwa assets generator on the fly:
from vite-plugin-pwa.
build also working:
from vite-plugin-pwa.
@xstevenyung remix not generating html page, this can be a problem, we need a navigate fallback page for offline handler
from vite-plugin-pwa.
how can I run the build locally? node build/server/index.js
seems to be not working...
from vite-plugin-pwa.
Here the repo: https://github.com/userquin/remix-pwa
from vite-plugin-pwa.
https://discord.com/channels/770287896669978684/1214618561851686983
from vite-plugin-pwa.
pnpm start
🤦♂️
from vite-plugin-pwa.
Using SPA mode (ssr: false
in remix plugin) remix build seems to generate the entry pont (index.html) after pwa plugin builds the service worker and so missing from the sw precache manifest (the index.html seems to be generated by the remix cli not by the plugin, vite-plugin-pwa should be called last in the pipeline, I'm going to test changing the priority in the build plugin to confirm the behavior).
It seems we can use SPA or SSR app, there is no hybrid mode.
from vite-plugin-pwa.
The sw being generated during client build, the SSR build and the SPA mode using another custom Vite build, I'll check if we can include the plugin in that build ( from remix CLI (?) ).
from vite-plugin-pwa.
Generated on writeBundle
hook, checking if the file is there when running the buildEnd
hook, maybe the globPatterns
and/or globDirectory
are wrong.
from vite-plugin-pwa.
@xstevenyung @kirbysayshi just found buildEnd
remix plugin hook, with SPA mode we can now include the entry point in the sw precache manifest.
I'm going to update the PR and merge into main, SSR App will require some additional work.
About SSR app, we'll need a new integration in ViteOrg for Remix.
from vite-plugin-pwa.
SPA mode in main https://github.com/userquin/remix-pwa
I'm going to add a new branch for SSR app.
from vite-plugin-pwa.
@xstevenyung you can check the hack for SSR in main: https://github.com/userquin/remix-pwa/blob/main/vite.config.ts
from vite-plugin-pwa.
just implemented, seems to work but i have to admit, i have a limited understanding on what's going on in the vite.config.ts
from vite-plugin-pwa.
thanks so much for your work 🙏
from vite-plugin-pwa.
Related Issues (20)
- InjectRegister not working when disabling manifest HOT 17
- 0.18.0 breaks `registerType: "prompt"` HOT 13
- How to cache image after ajax call HOT 8
- Cached files does not load pages except "/" (base path) in sveltekit HOT 29
- warn if header contains `<link>` to manifest HOT 2
- Error: Dynamic require of "workbox-build" is not supported HOT 1
- if workbox precache fails then there is not a way to identify that HOT 6
- BASE_URL resolves to undefined HOT 7
- There is a delay before check the latest version
- VitePWA injects an empty array into self.__WB_MANIFEST when using injectManifest HOT 2
- CSP errors when using nonce HOT 3
- `updateServiceWorker` doesn't trigger page reload since `v0.19.1` HOT 2
- How to remove a Service Worker installed before redirection
- I cant find in documentation how I can test my service worker HOT 1
- eslint config reminder: enable formatters and/or unocss
- The script has an unsupported MIME type ('text/html'). HOT 2
- VitePWA not working (white screen) when link is open from Meta in app browser. HOT 1
- PWA Assets generation on the fly HOT 5
- dev sw file gets created at "base/base/dev-sw.js?dev-sw" HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-pwa.