From b777bec22c32ab63f1335a14afec69c7e89cee01 Mon Sep 17 00:00:00 2001 From: npirotte Date: Tue, 26 Apr 2022 14:22:28 +0200 Subject: [PATCH 1/2] feat(remix/dev): Adds option wo watch extra files --- packages/remix-dev/compiler.ts | 2 +- packages/remix-dev/config.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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, From 274ee4a60247f720ece0e7a32f9e9b8b6c553997 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 26 Apr 2022 14:29:01 +0200 Subject: [PATCH 2/2] Update contributors.yml --- contributors.yml | 1 + 1 file changed, 1 insertion(+) 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