Skip to content

Commit 58ff849

Browse files
fix: server.preTransformRequests https error (#14991) (#14993)
1 parent 2a519a1 commit 58ff849

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/vite/src/node/server/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'node:path'
22
import type * as net from 'node:net'
33
import { get as httpGet } from 'node:http'
4+
import { get as httpsGet } from 'node:https'
45
import type * as http from 'node:http'
56
import { performance } from 'node:perf_hooks'
67
import type { Http2SecureServer } from 'node:http2'
@@ -497,7 +498,9 @@ export async function _createServer(
497498
// preTransformRequests needs to be enabled for this optimization.
498499
if (server.config.server.preTransformRequests) {
499500
setTimeout(() => {
500-
httpGet(
501+
const getMethod = path.startsWith('https:') ? httpsGet : httpGet
502+
503+
getMethod(
501504
path,
502505
{
503506
headers: {

0 commit comments

Comments
 (0)