diff --git a/contributors.yml b/contributors.yml index 2b38ed756e2..0eae9fafe08 100644 --- a/contributors.yml +++ b/contributors.yml @@ -331,3 +331,4 @@ - zachdtaylor - zainfathoni - zhe +- npirotte diff --git a/packages/remix-dev/compiler.ts b/packages/remix-dev/compiler.ts index ac165fe9b7a..2f16691a818 100644 --- a/packages/remix-dev/compiler.ts +++ b/packages/remix-dev/compiler.ts @@ -215,7 +215,7 @@ export async function watch( if (onRebuildFinish) onRebuildFinish(); }, 100); - let toWatch = [config.appDirectory]; + let toWatch = [config.appDirectory, ...config.extraPathsToWatch]; if (config.serverEntryPoint) { toWatch.push(config.serverEntryPoint); } diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index 8f0cc2b9128..a48507a4ce8 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -39,6 +39,12 @@ export interface AppConfig { */ appDirectory?: string; + /** + * List of extra paths or globs to watch changes on in addition to the main app directory. + * relative to `remix.config.js`. Defaults to `[]`. + */ + extraPathsToWatch?: string | string[]; + /** * The path to a directory Remix can use for caching things in development, * relative to `remix.config.js`. Defaults to `".cache"`. @@ -163,6 +169,11 @@ export interface RemixConfig { */ appDirectory: string; + /** + * List of extra paths or globs to watch changes on in addition to the main app directory. + */ + extraPathsToWatch: string[]; + /** * The absolute path to the cache directory. */ @@ -404,8 +415,15 @@ export async function readConfig( let serverDependenciesToBundle = appConfig.serverDependenciesToBundle || []; + let extraPathsToWatch: string[] = []; + + if (appConfig.extraPathsToWatch) { + extraPathsToWatch = extraPathsToWatch.concat(Array.isArray(appConfig.extraPathsToWatch) ? appConfig.extraPathsToWatch : [appConfig.extraPathsToWatch]); + } + return { appDirectory, + extraPathsToWatch, cacheDirectory, entryClientFile, entryServerFile,