vuejs / vitepress

Vite & Vue powered static site generator.

Home Page:https://vitepress.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Favicon not found when base is set by command line

mikigo opened this issue Β· comments

Describe the bug

// .vitepress/config.ts

head: [
        base: '/youqu/',
        ['link', {rel: 'icon', href: "/youqu/favicon.ico"}],
],

I need to build on two websites, one of which cannot find Favicon when using

pnpm run build --base /

How to dynamically specify base using the command line in Favicon?

Reproduction

How to dynamically specify base using the command line in Favicon?

Expected behavior

The Favicon configuration has added a base, which can still be dynamically specified through the command line

System Info

System:
    OS: Deepin 20.9
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 39.5 GB
  Binaries:
    Node: 18.16.1
    npm: 9.5.1
  Browsers:
    Edge: Spartan (44.22621.746.0), Chromium (106.0.1370.47)
  npmPackages:
    vitepress: 1.0.0-rc.36

Additional context

No response

Validations

help~~πŸ˜‚πŸ˜‚

You currently cannot. You can use some environment variable instead:

BASE='/' pnpm run build

In config:

base: process.env.BASE,
... href: `${process.env.BASE || '/'}favicon.ico` ...

cool...I'll give it a try.thanks homie.😘😘

ohno

image

why process.env.BASE is undefined

Don't use --base. You need to do BASE='/youqu/' pnpm run dev

ok, cool, bro~~

It worked. thanks 😘😘