Skip to content

Commit

Permalink
fix(dev): add option passed to chokidar
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin committed Sep 21, 2020
1 parent 96531fc commit 98151bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { IKoaProxiesOptions } from 'koa-proxies'
import { ServerOptions } from 'https'
import { lookupFile } from './utils'
import { Options as RollupTerserOptions } from 'rollup-plugin-terser'
import { WatchOptions as chokidarWatchOptions } from 'chokidar'

export type PreprocessLang = NonNullable<
SFCStyleCompileOptions['preprocessLang']
Expand Down Expand Up @@ -205,6 +206,10 @@ export interface ServerConfig extends SharedConfig {
* of multiple server plugin functions.
*/
configureServer?: ServerPlugin | ServerPlugin[]
/**
* The option passed to `chokidar`.
*/
watchOptions?: chokidarWatchOptions
}

export interface BuildConfig extends SharedConfig {
Expand Down
6 changes: 4 additions & 2 deletions src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export function createServer(config: ServerConfig): Server {
transforms = [],
vueCustomBlockTransforms = {},
optimizeDeps = {},
enableEsbuild = true
enableEsbuild = true,
watchOptions = {}
} = config

const app = new Koa<State, Context>()
Expand All @@ -67,7 +68,8 @@ export function createServer(config: ServerConfig): Server {
awaitWriteFinish: {
stabilityThreshold: 100,
pollInterval: 10
}
},
...watchOptions
}) as HMRWatcher
const resolver = createResolver(root, resolvers, alias)

Expand Down

0 comments on commit 98151bc

Please sign in to comment.