• 请不要在回答技术问题时复制粘贴 AI 生成的内容
zjjwhl
V2EX  ›  程序员

有关 vite 配置 pwa

  •  
  •   zjjwhl · Jan 11, 2022 · 1734 views
    This topic created in 1607 days ago, the information mentioned may be changed or developed.

    请问下 在 vite 里面 怎么配置 pwa 我按照文档 https://vite-plugin-pwa.netlify.app/ 在 vite.config.js 配置了

        VitePWA({
                registerType: 'autoUpdate',
                includeAssets: ['favicon.svg', 'robots.txt', 'safari-pinned-tab.svg'],
                manifest: {
                    name: 'test',
                    short_name: 'test',
                    theme_color: '#ffffff',
                    icons: [
                        {
                            src: '/pwa-192x192.png',
                            sizes: '192x192',
                            type: 'image/png',
                        },
                        {
                            src: '/pwa-512x512.png',
                            sizes: '512x512',
                            type: 'image/png',
                        },
                        {
                            src: '/pwa-512x512.png',
                            sizes: '512x512',
                            type: 'image/png',
                            purpose: 'any maskable',
                        },
                    ],
                },
            }),
    

    在 main.js 里面 添加了

    import { useRegisterSW } from 'virtual:pwa-register/vue';
    useRegisterSW();
    

    但是没什么效果 chrome 里面没有出现 app 的提示 请问下改怎么正确配置

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2299 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:38 · PVG 08:38 · LAX 17:38 · JFK 20:38
    ♥ Do have faith in what you're doing.