Code Monkey home page Code Monkey logo

gabsvuetifynoclinodewebpack's People

Contributors

hubert17 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

userquin

gabsvuetifynoclinodewebpack's Issues

`src/router.js` : remove/comment out sw register

Remove or comment out this:

// src/router.js
...
...
  /*
  comment out these callback if you want to use `prompt`
  router.onReady(async() => {
    const { registerSW } = await import("virtual:pwa-register")
    registerSW({ immediate: true })
  })
  */
...
...

Adjust all `base` to make correct configuration

This will work on any server, also on development:

// src/router.js
const router = new VueRouter({
  base: '/GabsVuetifyNoCLINodeWebpack/',
  mode: 'history', // real path
  routes, // short for `routes: routes`
});
// vite.config.js
...
  base: '/GabsVuetifyNoCLINodeWebpack/',
  plugins: [
    createVuePlugin(),
    VitePWA({
      // for prompt comment the option or just remove this option, since it is the default behavior */
      base: '/GabsVuetifyNoCLINodeWebpack/',
      registerType: 'prompt',
      includeAssets: ['favicon.svg'],
      manifest: {
        name: 'PWA Vue2',
        short_name: 'PWA Vue2',
        description: 'Vite PWA + Vue2 + Vite',
        theme_color: '#ffffff',
        start_url: '/GabsVuetifyNoCLINodeWebpack/',
        icons: [
...

PWA fully offline

Add this entry below manifest entry on vite.config.js.

      workbox: {
        runtimeCaching: [
          {
            urlPattern: /^https:\/\/cdn\.vuetifyjs\.com\/.*/i,
            handler: 'CacheFirst',
            options: {
              cacheName: 'vuetifyjs-cache',
              expiration: {
                maxEntries: 10,
                maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
              },
              cacheableResponse: {
                statuses: [0, 200],
              },
            },
          },
          {
            urlPattern: /^https:\/\/cdn\.jsdelivr\.net\/.*/i,
            handler: 'CacheFirst',
            options: {
              cacheName: 'jsdelivr-cache',
              expiration: {
                maxEntries: 10, 
                maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
              },
              cacheableResponse: {
                statuses: [0, 200],
              },
            },
          },
          {
            urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
            handler: 'CacheFirst',
            options: {
              cacheName: 'google-fonts-cache',
              expiration: {
                maxEntries: 10, 
                maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
              },
              cacheableResponse: {
                statuses: [0, 200],
              },
            },
          },
          {
            urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
            handler: 'CacheFirst',
            options: {
              cacheName: 'gstatic-fonts-cache',
              expiration: {
                maxEntries: 10, 
                maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
              },
              cacheableResponse: {
                statuses: [0, 200],
              },
            },
          },
        ],

You also need to add to index.html crossorigin="anonymous" to exteranl links and scripts:

    <link crossorigin="anonymous" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons" rel="stylesheet" />
    <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet" />
    <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet" />

    <title>Hello Vue World!</title>
    <script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
    <script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.js"></script>
    <script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-router.js"></script>
    <script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex.js"></script>
    <script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js"></script>

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.