Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable debug logging for workbox service worker? #652

Open
MoritzLost opened this issue Jan 26, 2024 · 1 comment
Open

How to enable debug logging for workbox service worker? #652

MoritzLost opened this issue Jan 26, 2024 · 1 comment

Comments

@MoritzLost
Copy link

MoritzLost commented Jan 26, 2024

I'm trying to enable debug logging for the generated service worker (using the generateSW strategy) when building the app using npm run build. I'm not seeing any log output from workbox in the console. According to the documentation, debugging can be activated by setting mode: development in the workbox options. But this isn't working. I've tried setting the mode to development at every conceivable level to no avail (I'm using the astro integration, but I don't think this makes a difference here):

// astro.config.mjs
import { defineConfig } from 'astro/config';
import AstroPWA from '@vite-pwa/astro';
import manifest from './src/data/manifest.js';

export default defineConfig({
    vite: {
        mode: 'development',
    },
    integrations: [
        AstroPWA({
            manifest,
            mode: 'development',
            injectRegister: null,
            registerType: 'autoUpdate',
            workbox: {
                mode: 'development',
                globPatterns: ['**/*'],
                navigateFallback: '/404',
            },
            experimental: {
                directoryAndTrailingSlashHandler: true,
            },
        }),
    ],
});

I've also tried setting the mode as a CLI parameter:

NODE_ENV=development npm run build --mode development

How can I enable workbox debug logging?

@justingrant
Copy link

You may need to adjust your browser console's filters to show Verbose-level logging. In Chrome, the default omits Verbose.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants