Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(remix-dev): add extraPathsToWatch config option #2985

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,4 @@
- zachdtaylor
- zainfathoni
- zhe
- npirotte
2 changes: 1 addition & 1 deletion packages/remix-dev/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
18 changes: 18 additions & 0 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"`.
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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,
Expand Down