Skip to content

Commit 57b0f91

Browse files
Nstttclaude
andcommitted
fix(esbuild): fix esbuild 0.25.0 compatibility for watch mode
- Use esbuild context() API for watch mode (0.25.0 removed watch option) - Enables proper build and watch functionality in apps/esbuild demo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 47f1818 commit 57b0f91

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

apps/esbuild/build/build-common.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function buildProject(projectName, watch) {
1111

1212
fs.rmSync(outputPath, { force: true, recursive: true });
1313

14-
await esbuild.build({
14+
const buildOptions = {
1515
entryPoints: [path.join(projectName, 'main.ts')],
1616
outdir: outputPath,
1717
bundle: true,
@@ -28,8 +28,15 @@ async function buildProject(projectName, watch) {
2828
require(path.join('../', projectName, 'federation.config.js')),
2929
),
3030
],
31-
watch,
32-
});
31+
};
32+
33+
if (watch) {
34+
const ctx = await esbuild.context(buildOptions);
35+
await ctx.watch();
36+
console.log(`Watching ${projectName} for changes...`);
37+
} else {
38+
await esbuild.build(buildOptions);
39+
}
3340

3441
['index.html', 'favicon.ico', 'styles.css'].forEach((file) => {
3542
fs.copyFileSync(path.join(projectName, file), path.join(outputPath, file));

0 commit comments

Comments
 (0)