Skip to content

Commit

Permalink
fix: this._implicitHeader is not a function (#6313)
Browse files Browse the repository at this point in the history
  • Loading branch information
Niputi committed Dec 30, 2021
1 parent db36e81 commit c5ba2f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/vite/src/node/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ export async function resolveHttpServer(
app: Connect.Server,
httpsOptions?: HttpsServerOptions
): Promise<HttpServer> {
/*
* Some Node.js packages are known to be using this undocumented function,
* notably "compression" middleware.
*/
app.prototype._implicitHeader = function _implicitHeader() {
this.writeHead(this.statusCode)
}

if (!httpsOptions) {
return require('http').createServer(app)
}
Expand Down

0 comments on commit c5ba2f2

Please sign in to comment.