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

fix: make html-proxy css request pass importAnalysis #8095

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/vite/src/node/plugins/css.ts
Expand Up @@ -121,8 +121,10 @@ type CssLang = keyof typeof PureCssLang | keyof typeof PreprocessLang
export const isCSSRequest = (request: string): boolean =>
cssLangRE.test(request)

// htmlProxyRE is used to check if the request is a html proxy request and it will return css.
export const isDirectCSSRequest = (request: string): boolean =>
cssLangRE.test(request) && directRequestRE.test(request)
cssLangRE.test(request) &&
(directRequestRE.test(request) || htmlProxyRE.test(request))

export const isDirectRequest = (request: string): boolean =>
directRequestRE.test(request)
Expand Down
11 changes: 10 additions & 1 deletion playground/css/index.html
@@ -1,5 +1,14 @@
<link rel="stylesheet" href="./linked.css" />

<style>
/* latin */
@font-face {
font-family: 'Roboto';
src: url(https://abc.woff2) format('woff2');
}
body {
font-family: Roboto, sans-serif;
}
</style>
<div class="wrapper">
<h1>CSS</h1>

Expand Down