Skip to content

Commit

Permalink
fix: don't pretransform classic script links (#15361)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 22, 2023
1 parent 5684fcd commit 19e3c9a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/server/middlewares/indexHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const processNodeUrl = (
htmlPath: string,
originalUrl?: string,
server?: ViteDevServer,
isClassicScriptLink?: boolean,
): string => {
// prefix with base (dev only, base is never relative)
const replacer = (url: string) => {
Expand Down Expand Up @@ -155,7 +156,7 @@ const processNodeUrl = (
url = path.posix.join(config.base, url)
}

if (server && shouldPreTransform(url, config)) {
if (server && !isClassicScriptLink && shouldPreTransform(url, config)) {
let preTransformUrl: string | undefined
if (url[0] === '/' && url[1] !== '/') {
preTransformUrl = url
Expand Down Expand Up @@ -271,6 +272,7 @@ const devHtmlHook: IndexHtmlTransformHook = async (
htmlPath,
originalUrl,
server,
!isModule,
)
if (processedUrl !== src.value) {
overwriteAttrValue(s, sourceCodeLocation!, processedUrl)
Expand Down

0 comments on commit 19e3c9a

Please sign in to comment.