vitepress
vitepress copied to clipboard
Favicon not found when base is set by command line
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
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
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
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 😘😘