Skip to content

Commit

Permalink
fix dev watcher (#1816)
Browse files Browse the repository at this point in the history
We were using include options wrong in the watcher
  • Loading branch information
wardpeet authored Feb 10, 2025
1 parent f204405 commit 813c719
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-donuts-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mastra': patch
---

Fix watcher in mastra dev, now listens to all files
16 changes: 13 additions & 3 deletions packages/cli/src/commands/dev/DevBundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,27 @@ export class DevBundler extends MastraBundler {
join(this.mastraDir, 'index.js'),
]);

const envFiles = await this.getEnvFiles();
const inputOptions = await getWatcherInputOptions(entryFile, 'node');

const watcher = await createWatcher(
{
...inputOptions,
plugins: [
// @ts-ignore - types are good
...inputOptions.plugins,
{
name: 'env-watcher',
buildStart() {
for (const envFile of envFiles) {
this.addWatchFile(envFile);
}
},
},
],
input: {
index: join(__dirname, 'templates', 'dev.entry.js'),
},
watch: {
include: await this.getEnvFiles(),
},
},
{
dir: outputDirectory,
Expand Down

0 comments on commit 813c719

Please sign in to comment.