Skip to content

Commit

Permalink
fix(devserver): expose startupTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhaenisch committed Nov 6, 2020
1 parent 4fc3dc0 commit 0046051
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/declarations/stencil-public-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,12 @@ export interface StencilDevServerConfig {
*/
ssr?: boolean;
/**
* If to use the dev server's websocket client or not. Defaults to `true`.
* If the dev server fails to start up within the given timout (in milliseconds), the startup will
* be canceled. Set to zero to disable the timeout. Defaults to `15000`.
*/
startupTimeout?: number;
/**
* Whether to use the dev server's websocket client or not. Defaults to `true`.
*/
websocket?: boolean;
/**
Expand All @@ -440,7 +445,6 @@ export interface DevServerConfig extends StencilDevServerConfig {
prerenderConfig?: string;
protocol?: 'http' | 'https';
srcIndexHtml?: string;
startupTimeout?: number;
}

export interface HistoryApiFallback {
Expand Down
4 changes: 2 additions & 2 deletions src/dev-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ function startServer(
const timespan = logger.createTimeSpan(`starting dev server`, true);

const startupTimeout =
logger.getLevel() !== 'debug'
logger.getLevel() !== 'debug' || devServerConfig.startupTimeout !== 0
? setTimeout(() => {
reject(`dev server startup timeout`);
}, devServerConfig.startupTimeout || 15000)
}, devServerConfig.startupTimeout ?? 15000)
: null;

let isActivelyBuilding = false;
Expand Down

0 comments on commit 0046051

Please sign in to comment.