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 watchPaths config option #3188

Merged
merged 4 commits into from
Jun 30, 2022
Merged
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ export interface AppConfig {
/**
* A function for defining custom directories to watch while running `remix dev`, in addition to `appDirectory`.
*/
watchPaths?: () => Promise<string | string[]>;
watchPaths?:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better!

| string
| string[]
| (() => Promise<string | string[]> | string | string[]);
}

/**
Expand Down Expand Up @@ -406,11 +409,17 @@ export async function readConfig(
}

let watchPaths: string[] = [];
if (appConfig.watchPaths) {
if (typeof appConfig.watchPaths === "function") {
let directories = await appConfig.watchPaths();
watchPaths = watchPaths.concat(
Array.isArray(directories) ? directories : [directories]
);
} else if (appConfig.watchPaths) {
watchPaths = watchPaths.concat(
Array.isArray(appConfig.watchPaths)
? appConfig.watchPaths
: [appConfig.watchPaths]
);
}

let serverBuildTargetEntryModule = `export * from ${JSON.stringify(
Expand Down