Skip to content

Commit

Permalink
fix: execute build even if inkline config file not present
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrozav committed Jan 5, 2023
1 parent a01d74e commit 9ed66a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugin/watch.ts
Expand Up @@ -2,13 +2,13 @@ import { UserOptions } from "./types";
import * as chokidar from "chokidar";
import { build } from "./build";
import { getResolvedOptions } from "@inkline/config";
import { existsSync } from "fs";

/**
* Watch config file for changes and rebuild
*/
export async function watch(options: UserOptions) {
const { configFile } = getResolvedOptions(options);

const watcher = chokidar.watch(configFile, {
persistent: true,
});
Expand All @@ -17,7 +17,8 @@ export async function watch(options: UserOptions) {
await build(options);
};

watcher.on("add", watchFn).on("change", watchFn);
watcher.on("change", watchFn);
await watchFn();

return watcher;
}

0 comments on commit 9ed66a5

Please sign in to comment.