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

Favicon not found when base is set by command line #3869

Closed
4 tasks done
mikigo opened this issue May 8, 2024 · 6 comments
Closed
4 tasks done

Favicon not found when base is set by command line #3869

mikigo opened this issue May 8, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@mikigo
Copy link

mikigo commented May 8, 2024

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

@mikigo mikigo added the bug: pending triage Maybe a bug, waiting for confirmation label May 8, 2024
@brc-dd brc-dd added enhancement New feature or request and removed bug: pending triage Maybe a bug, waiting for confirmation labels May 8, 2024
@mikigo
Copy link
Author

mikigo commented May 10, 2024

help~~😂😂

@brc-dd
Copy link
Member

brc-dd commented May 10, 2024

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` ...

@mikigo
Copy link
Author

mikigo commented May 10, 2024

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

@mikigo
Copy link
Author

mikigo commented May 10, 2024

ohno

image

why process.env.BASE is undefined

@brc-dd
Copy link
Member

brc-dd commented May 10, 2024

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

@mikigo
Copy link
Author

mikigo commented May 10, 2024

ok, cool, bro~~

It worked. thanks 😘😘

@mikigo mikigo closed this as completed May 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants