vue
vue copied to clipboard
(compiler-sfc) transformAssetUrl breaks when base includes host
Version
2.7.8
Reproduction link
github.com/jonaskuske/vue2-asset-base-repro
Steps to reproduce
- Run
npm i
to install dependencies - Run
npm run dev
to start the Vite dev server - Visit
[
localhost:5179`](http://localhost:5179) - Observe that the request for
javascript.svg
fails because the URL is broken
What is expected?
The image src
is transformed to a valid URL (http://locahost:5173/...
)
What is actually happening?
Since all parts are passed to path.join
, the URL breaks as one slash is stripped from the protocol (http:/localhost:5173/...
)
This is fixed in the v3 version of compiler-sfc, submitted a PR that applies the same behavior to v2 :)