Skip to content

Commit 19e3c9a

Browse files
authored
fix: don't pretransform classic script links (#15361)
1 parent 5684fcd commit 19e3c9a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/vite/src/node/server/middlewares/indexHtml.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ const processNodeUrl = (
127127
htmlPath: string,
128128
originalUrl?: string,
129129
server?: ViteDevServer,
130+
isClassicScriptLink?: boolean,
130131
): string => {
131132
// prefix with base (dev only, base is never relative)
132133
const replacer = (url: string) => {
@@ -155,7 +156,7 @@ const processNodeUrl = (
155156
url = path.posix.join(config.base, url)
156157
}
157158

158-
if (server && shouldPreTransform(url, config)) {
159+
if (server && !isClassicScriptLink && shouldPreTransform(url, config)) {
159160
let preTransformUrl: string | undefined
160161
if (url[0] === '/' && url[1] !== '/') {
161162
preTransformUrl = url
@@ -271,6 +272,7 @@ const devHtmlHook: IndexHtmlTransformHook = async (
271272
htmlPath,
272273
originalUrl,
273274
server,
275+
!isModule,
274276
)
275277
if (processedUrl !== src.value) {
276278
overwriteAttrValue(s, sourceCodeLocation!, processedUrl)

0 commit comments

Comments
 (0)