mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 14:48:41 +00:00
fix: consider URLs with any protocol to be external (#17369)
Co-authored-by: patak-dev <matias.capeletto@gmail.com> Co-authored-by: bluwy <bjornlu.dev@gmail.com> Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
This commit is contained in:
parent
2c10f9a452
commit
a0336bd519
@ -509,7 +509,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
|
||||
// If resolvable, let's resolve it
|
||||
if (specifier !== undefined) {
|
||||
// skip external / data uri
|
||||
if (isExternalUrl(specifier) || isDataUrl(specifier)) {
|
||||
if (
|
||||
(isExternalUrl(specifier) && !specifier.startsWith('file://')) ||
|
||||
isDataUrl(specifier)
|
||||
) {
|
||||
return
|
||||
}
|
||||
// skip ssr externals and builtins
|
||||
|
@ -262,7 +262,7 @@ export function isSameFileUri(file1: string, file2: string): boolean {
|
||||
)
|
||||
}
|
||||
|
||||
export const externalRE = /^(https?:)?\/\//
|
||||
export const externalRE = /^([a-z]+:)?\/\//
|
||||
export const isExternalUrl = (url: string): boolean => externalRE.test(url)
|
||||
|
||||
export const dataUrlRE = /^\s*data:/i
|
||||
|
Loading…
Reference in New Issue
Block a user