GithubHelp home page GithubHelp logo

Comments (29)

userquin avatar userquin commented on June 3, 2024 2

I Will try to add an example and include remix in the docs...

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024 1

spa pwa changes can be found here with some configuration changes: userquin/remix-pwa#1

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024 1

@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.

userquin avatar userquin commented on June 3, 2024

importing virtual:pwa-info not working? https://github.com/vite-pwa/vite-plugin-pwa/blob/main/info.d.ts

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

check this sveltekit example: https://github.com/vite-pwa/sveltekit/blob/main/examples/sveltekit-ts/src/routes/%2Blayout.svelte#L6

from vite-plugin-pwa.

kirbysayshi avatar kirbysayshi commented on June 3, 2024

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.

xstevenyung avatar xstevenyung commented on June 3, 2024

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.

userquin avatar userquin commented on June 3, 2024

You can also check astro integration examples, check the default layout.

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

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.

xstevenyung avatar xstevenyung commented on June 3, 2024

thanks for the quick response, happy to help if you need any assistance for this!

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

like a beast, custom sw on dev server with pwa assets generator on the fly:

imagen

imagen

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

build also working:

imagen

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

@xstevenyung remix not generating html page, this can be a problem, we need a navigate fallback page for offline handler

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

how can I run the build locally? node build/server/index.js seems to be not working...

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

Here the repo: https://github.com/userquin/remix-pwa

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

https://discord.com/channels/770287896669978684/1214618561851686983

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

pnpm start 🤦‍♂️

imagen

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

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.

userquin avatar userquin commented on June 3, 2024

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 (?) ).

imagen

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

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.

userquin avatar userquin commented on June 3, 2024

@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.

imagen

from vite-plugin-pwa.

userquin avatar userquin commented on June 3, 2024

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.

userquin avatar userquin commented on June 3, 2024

@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.

xstevenyung avatar xstevenyung commented on June 3, 2024

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.

xstevenyung avatar xstevenyung commented on June 3, 2024

thanks so much for your work 🙏

from vite-plugin-pwa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.