Giter Club home page Giter Club logo

vitepress's Issues

After wrapping defineConfig with withPwa, I can't get defineConfig in other ts files

import type { Plugin,UserConfig } from 'vitepress'
import { generateSidebar } from './sidebar';
import defineConfig from '../config';

export const FileHMR = (): Plugin => {
    return {
        name: 'vite-file-hmr',
        configureServer({
            watcher,
            restart
        }) {
            const fsWatcher = watcher.add('*.md');
            fsWatcher.on('all', async (event: string, path: string) => {
                if (event !== 'change') {
                    try {
                        (defineConfig as UserConfig).themeConfig.sidebar = generateSidebar()
                        await restart();
                    } catch (error: any){
                        console.log("πŸš€ ", (defineConfig as UserConfig).themeConfig)
                        console.log(error)
                    }
                }
            });
        },
    }
}

generatesidebar() is used to automatically generate the configuration structure of sidebar, so sidebar will not be updated automatically when vite changes the file, so I use the above code for hot update, but I can't get sidebar after wrapping defineConfig withPwa.

image

change image title

the hero image should be for VitePress, like the title: Zero-config PWA Plugin for VitePress

@antfu do you like that change? If so, can you change/provide the hero image?

Pending

We need:

  • modify injectRegister to be 'virtual' | 'script' | 'inline': defaults to script?
  • inject webmanifest in VitePress head: we need to handle dev or build mode
  • inject registerSW.js or inline code to register the sw when injectRegister !== 'virtual' (if using virtual, just ignore it)
  • add example with prompt: requires SFC (quite simple)

check mpa

not working in pwa-prompt example, there is no client build!

EDIT: we should check if adding a custom plugin removing the ssr check (on pwa build plugin) works (it should work: we're getting the api reference using mpa flag)

[BUG] "Hydration completed but contains mismatches" when path contains URL params

Describe the bug

When I add some url params such as ?a=1&b=2 after the page's URL, the console log an error Hydration completed but contains mismatches. and the page rendering is incorrect

Reproduction

  1. Clone from https://github.com/GlobeMC/crashmc.com
  2. pnpm install && pnpm run docs:build && pnpm run docs:preview
  3. Access http://localhost:4173/client/system.html and http://localhost:4173/client/system.html?someparam=somevalue
  4. The page without param will works well, but the page with the URL param will somehow mixed with the home page's content

OR

Just access https://vite-pwa-org.netlify.app/guide/register-service-worker.html?

Expected behavior

The two pages should looks exactly same.

Some information at vuejs/vitepress#3469

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.