Skip to content

设置带域名的base后,编译后img地址错误 #3598

@whwnow

Description

@whwnow

Describe the bug

设置带域名的base后,编译后img地址错误

Reproduction

当我设置了base 是一个 oss的域名后,config 配置如下:
base: 'https:/xxx.oss-rg-china-mainland.aliyuncs.com/',

index.md 中使用 public 目录中的logo.png,部分index.md 如下:

# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
  name: xxx
  text: xxx
  tagline: xxx
  actions:
    - theme: brand
      text: 联系我们
      link: /contact-us
  image:
    src: /logo.png
    alt: xxx

但执行 build 后的 dist 目录中,src 的路径中是 https:/xxx 少了一个 /,关键代码如下

<img class="VPImage image-src" src="https:/xxx.oss-rg-china-mainland.aliyuncs.com/logo.png" alt="xxx" data-v-1496cb03>

Expected behavior

应该是https://

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
    Memory: 16.70 GB / 31.80 GB
  Binaries:
    Node: 18.19.0 - ~\AppData\Local\pnpm\node.EXE
    npm: 10.2.3 - ~\AppData\Local\pnpm\npm.CMD
    pnpm: 8.14.1 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (121.0.2277.128)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    vitepress: latest => 1.0.0-rc.42

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions