Do NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
I created a vite app via create-vite-app and added base config in vite.config.js, I set vite.config.js base config to a CDN path, like https://some-cdn.com/vite-app/.
module.exports = {
base: "https://some-cdn.com/vite-app/",
};
vite.config.js
|
export interface BuildConfig extends SharedConfig { |
|
/** |
|
* Base public path when served in production. |
|
* @default '/' |
|
*/ |
|
base?: string |
The js and css assets files work well
<script type="module" src="https://some-cdn.com/vite-app/assets/index.js"></script>
but the <img /> src url will start with https:/some-cdn.com, it's https:/ not https:// (maybe resolved as a relative path?) ,
the img src path will be https://some-cdn.com/vite-app/https:/some-cdn.com/vite-app/assets/logo.3e99d14e.png
see create-vite-app source code
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Hello Vue 3.0 + Vite" />
</template>
build result
<img alt="Vue logo" src="https:/some-cdn.com/vite-app/assets/logo.3e99d14e.png">
Reproduction
Please provide a link to a repo that can reproduce the problem you ran into.
see create-vite-app template
https://github.com/vitejs/create-vite-app/blob/master/template-vue/src/App.vue#L1-L4
with vite.config.js
module.exports = {
base: "https://some-cdn.com/vite-app/",
};
System Info
- required
vite version: 0.14.4
- required Operating System: macOS 10.14.6 Darwin Kernel Version 18.7.0
- required Node version: v12.16.3
- Optional:
- npm/yarn version npm@6.14.5 yarn@1.22.0
- Installed
vue version (from yarn.lock or package-lock.json) 3.0.0-beta.18
- Installed
@vue/compiler-sfc version 3.0.0-beta.18
Logs (Optional if provided reproduction)
- Run
vite or vite build with the --debug flag.
- Provide the error log here.
vite build --debug
yarn run v1.22.0
warning package.json: No license field
$ vite build --debug
vite v0.14.4
vite:config config resolved in 0ms +0ms
Building for production...
vite:build:asset /Users/{path}/vite-app/logo.png -> https:/some-cdn.com/vite-app/assets/logo.032c3e65.png +0ms
[write] dist/assets/index.js 44.05kb, brotli: 15.92kb
[write] dist/assets/style.css 0.33kb, brotli: 0.16kb
[write] dist/assets/logo.032c3e65.png 6.69kb, brotli: 6.26kb
[write] dist/index.html 0.30kb, brotli: 0.12kb
Build completed in 2.44s.
✨ Done in 2.78s.
Describe the bug
I created a vite app via create-vite-app and added base config in vite.config.js, I set vite.config.js base config to a CDN path, like
https://some-cdn.com/vite-app/.vite.config.js
vite/src/node/config.ts
Lines 171 to 176 in f5d9a8e
The js and css assets files work well
but the
<img />src url will start withhttps:/some-cdn.com, it'shttps:/nothttps://(maybe resolved as a relative path?) ,the img src path will be
https://some-cdn.com/vite-app/https:/some-cdn.com/vite-app/assets/logo.3e99d14e.pngsee create-vite-app source code
build result
Reproduction
Please provide a link to a repo that can reproduce the problem you ran into.
see create-vite-app template
https://github.com/vitejs/create-vite-app/blob/master/template-vue/src/App.vue#L1-L4
with vite.config.js
System Info
viteversion: 0.14.4vueversion (fromyarn.lockorpackage-lock.json) 3.0.0-beta.18@vue/compiler-sfcversion 3.0.0-beta.18Logs (Optional if provided reproduction)
viteorvite buildwith the--debugflag.vite build --debug