Giter Club home page Giter Club logo

remix's Introduction

@vite-pwa/remix - Zero-config PWA Plugin for Remix
Zero-config PWA Plugin for Remix

NPM version NPM Downloads Docs & Guides
GitHub stars


🚀 Features

  • 📖 Documentation & guides
  • 👌 Zero-Config: sensible built-in default configs for common use cases
  • 🔩 Extensible: expose the full ability to customize the behavior of the plugin
  • 🦾 Type Strong: written in TypeScript
  • 🔌 Offline Support: generate service worker with offline support (via Workbox)
  • Fully tree shakable: auto inject Web App Manifest
  • 💬 Prompt for new content: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS and Preact
  • ⚙️ Stale-while-revalidate: automatic reload when new content is available
  • Static assets handling: configure static assets for offline support
  • 🐞 Development Support: debug your custom service worker logic as you develop your application
  • 🛠️ Versatile: integration with meta frameworks: îles, SvelteKit, VitePress, Astro, Nuxt 3 and Remix
  • 💥 PWA Assets Generator: generate all the PWA assets from a single command and a single source image
  • 🚀 PWA Assets Integration: serving, generating and injecting PWA Assets on the fly in your application

📦 Install

@vite-pwa/remix requires Vite 5 and Remix 2.8.0 or above.

npm i @vite-pwa/remix -D 

# yarn 
yarn add @vite-pwa/remix -D

# pnpm 
pnpm add @vite-pwa/remix -D

🦄 Usage

Import the @vite-pwa/remix helper, create the Remix PWA Preset and the PWA Plugin and configure them in your Vite configuration file:

// vite.config.js
import { vitePlugin as remix } from '@remix-run/dev'
import { installGlobals } from '@remix-run/node'
import { defineConfig } from 'vite'
import { RemixVitePWA } from '@vite-pwa/remix'

installGlobals()

const { RemixVitePWAPlugin, RemixPWAPreset } = RemixVitePWA()

export default defineConfig({
  plugins: [
    remix({
      presets: [RemixPWAPreset()],
    }),
    RemixVitePWAPlugin({
      // PWA options
    })
  ]
})

Read the 📖 documentation for a complete guide on how to configure and use this plugin.

👀 Full config

Check out the following links for more details:

📄 License

MIT License © 2024-PRESENT Anthony Fu

remix's People

Contributors

userquin avatar aslemammad avatar

Stargazers

TheLazyCatt avatar Mateusz Wszoła avatar Lasha Lezhava avatar 이헌기 avatar  avatar Alex Lévy avatar webdev.sharex avatar yupix avatar Hrafnkell Pálsson avatar  avatar Matthew Fainman avatar Steven Yung avatar Herb Caudill avatar Jira Nguyễn avatar  avatar Abdur-Rahman avatar jokay03J avatar  avatar Kadeem Lewis avatar Alexandre avatar いもけん avatar Christian Cito avatar Dario Ielardi avatar Hung Nguyen avatar  avatar Son Tran avatar Darius avatar Marcelo Dias avatar  avatar ishan avatar Jacky Hu avatar Sébastien Lorber avatar Timo Strackfeldt avatar Vicky Hermawan avatar Enggar Tivandi avatar 无尘室内点墨 avatar Muhamad Rijal avatar Claus Haas avatar Sam avatar Yann avatar M Haidar Hanif avatar Sardor Astanov avatar Daniel Roe avatar

Watchers

 avatar

Forkers

mbsyaswanth

remix's Issues

Service Worker does not get registered

First of all thanks for working on a remix template for vite-pwa!

I'm currently converting a CRA SPA into a remix app. I've followed the starting guide, this is my vite.config.js:

import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import { execSync } from "child_process";
import { installGlobals } from "@remix-run/node";
import { RemixVitePWA } from "@vite-pwa/remix";
import fixReactVirtualized from "esbuild-plugin-react-virtualized";

const COMMIT_HASH = execSync("git rev-parse HEAD").toString().trim();
installGlobals();

const { RemixVitePWAPlugin, RemixPWAPreset } = RemixVitePWA();

export default defineConfig({
  plugins: [
    remix({
      ssr: false,
      presets: [RemixPWAPreset()],
    }),
    RemixVitePWAPlugin({
      registerType: "autoUpdate",
    }),
  ],
  define: {
    __COMMIT_HASH__: JSON.stringify(COMMIT_HASH),
  },
  optimizeDeps: {
    include: ["@mui/material/Tooltip"],
    esbuildOptions: {
      plugins: [fixReactVirtualized],
    },
  },
});

The guide makes it sound like this is all it takes to create and register the web worker?

I can see that the service worker gets generated and there is a registerSW.js file in the build, but this file never gets called.
Do I need to import the registerSW.js file somewhere manually? Or how is this supposed to work?

Thankful for a pointer in the right direction!

Unable to Run Example

Steps to Reproduce:

  1. Copy the folder remix/examples/pwa-simple-sw into a separate directory.
  2. In package.json, replace "@vite-pwa/remix": "workspace:*" with "@vite-pwa/remix": "^0.0.1".
  3. Run npm i.
  4. Run npm run dev.

Result:

When attempting to access http://localhost:5173/, an error occurs:

[vite] Internal server error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'virtual:'

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.