Rework SDK watcher (#17305)
This commit is contained in:
@@ -20,7 +20,7 @@ const buildFunctionEntries = (
|
||||
const entries: Record<string, string> = {};
|
||||
|
||||
for (const fn of handlerPaths) {
|
||||
const { relativePath } = computeFunctionOutputPath(fn.handlerPath);
|
||||
const relativePath = computeFunctionOutputPath(fn.handlerPath);
|
||||
const chunkName = relativePath.replace(/\.js$/, '');
|
||||
entries[chunkName] = path.join(appPath, fn.handlerPath);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export class FunctionsWatcher implements RestartableWatcher {
|
||||
}
|
||||
|
||||
shouldRestart(manifest: ApplicationManifest): boolean {
|
||||
const newEntries = buildFunctionEntries(this.appPath, manifest.serverlessFunctions);
|
||||
const newEntries = buildFunctionEntries(this.appPath, manifest.serverlessFunctions ?? []);
|
||||
const currentKeys = Object.keys(this.entries).sort();
|
||||
const newKeys = Object.keys(newEntries).sort();
|
||||
|
||||
@@ -96,7 +96,7 @@ export class FunctionsWatcher implements RestartableWatcher {
|
||||
await this.innerWatcher?.close();
|
||||
this.innerWatcher = null;
|
||||
|
||||
this.entries = buildFunctionEntries(this.appPath, manifest.serverlessFunctions);
|
||||
this.entries = buildFunctionEntries(this.appPath, manifest.serverlessFunctions ?? []);
|
||||
|
||||
if (this.hasEntries()) {
|
||||
console.log(chalk.blue(' 📦 Building functions...'));
|
||||
@@ -144,7 +144,7 @@ export class FunctionsWatcher implements RestartableWatcher {
|
||||
outDir: functionsOutputDir,
|
||||
emptyOutDir: false,
|
||||
watch: {
|
||||
include: ['src/**/*.ts', 'src/**/*.json'],
|
||||
include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.json'],
|
||||
exclude: ['node_modules/**', '.twenty/**', 'dist/**'],
|
||||
},
|
||||
lib: {
|
||||
|
||||
Reference in New Issue
Block a user