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

有关 vite 配置 pwa

  •  
  •   zjjwhl · Jan 11, 2022 · 1746 views
    This topic created in 1615 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   ·   5601 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 06:03 · PVG 14:03 · LAX 23:03 · JFK 02:03
    ♥ Do have faith in what you're doing.