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

externalRE is not supported automatic http/https prefix url pattern #4920

Closed
qiyuan-wang opened this issue Nov 9, 2021 · 1 comment · Fixed by #4922
Closed

externalRE is not supported automatic http/https prefix url pattern #4920

qiyuan-wang opened this issue Nov 9, 2021 · 1 comment · Fixed by #4922
Labels

Comments

@qiyuan-wang
Copy link
Contributor

Version

3.2.21

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  1. 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>
  1. 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?:\/\//

https://github.com/vuejs/vue-next/blob/065c367175c0e93b3cce38d0a031c94c59e570ff/packages/compiler-sfc/src/templateUtils.ts#L9

@qiyuan-wang
Copy link
Contributor Author

Maybe /^(https?:)?\/\// is better.

@qiyuan-wang qiyuan-wang changed the title externalRE is not supported automatic http/https prefix url externalRE is not supported automatic http/https prefix url pattern Nov 9, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants