Skip to content

Commit

Permalink
fix: fallback to https when using secure and proxies (closes vitejs#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhsu committed Jul 2, 2020
1 parent a26d61b commit 541b8d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@rollup/plugin-node-resolve": "^8.0.0",
"@types/koa": "^2.11.3",
"@types/lru-cache": "^5.1.0",
"@types/mime-types": "^2.1.0",
"@vue/compiler-dom": "^3.0.0-beta.14",
"@vue/compiler-sfc": "^3.0.0-beta.14",
"brotli-size": "^4.0.0",
Expand Down
8 changes: 7 additions & 1 deletion src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ export function createServer(config: ServerConfig): Server {
}

function resolveServer(
{ https = false, httpsOptions = {} }: ServerConfig,
{ https = false, httpsOptions = {}, proxy }: ServerConfig,
requestListener: RequestListener
) {
if (https) {
if (proxy && Object.keys(proxy).length > 0) {
return require('https').createServer(
resolveHttpsConfig(httpsOptions),
requestListener
)
}
return require('http2').createSecureServer(
{
...resolveHttpsConfig(httpsOptions),
Expand Down
2 changes: 1 addition & 1 deletion src/node/server/serverPluginHmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export function rewriteFileWithHMR(
)
}

const method = node.callee.property.name
const method = (node.callee.property as { name: string }).name
if (method === 'accept' || method === 'acceptDeps') {
if (!isDevBlock) {
console.error(
Expand Down

0 comments on commit 541b8d7

Please sign in to comment.