externalRE is not supported automatic http/https prefix url pattern
qiyuan-wang opened this issue · 1 comments
qiyuan-wang commented
Version
3.2.21
Reproduction link
Steps to reproduce
- In template, set an img tag's src with an url with something like "//via.placeholder.com/150":
<template>
<!-- other stuff -->
<img src="//via.placeholder.com/150" />
<!-- other stuff -->
</template>
- run
vite build
What is expected?
Build process finished successfully.
What is actually happening?
Rollup emit a error with failed to resolve import [img url]
The externalRE is not supported the pattern of automatic http/https prefix by browser.
SFC-compiler took "//via.placeholder.com/150" as a module and raised the error.
const externalRE = /^https?:\/\//
qiyuan-wang commented
Maybe /^(https?:)?\/\//
is better.