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

WatchMode.onRebuild not called if initial build failed #2499

Closed
Vendicated opened this issue Aug 29, 2022 · 3 comments · Fixed by #2816
Closed

WatchMode.onRebuild not called if initial build failed #2499

Vendicated opened this issue Aug 29, 2022 · 3 comments · Fixed by #2816

Comments

@Vendicated
Copy link

Vendicated commented Aug 29, 2022

If you have multiple esbuild watchers running and one of them fails, that watcher will stop calling onRebuild even though the watcher is still running and rebuilding that file

Build Script

import esbuild from "esbuild";

const watch = {
    onRebuild: (err) => {
        if (err) console.error("Build Error", err.message);
        else console.log("Rebuilt!");
    }
};

await Promise.all([
    esbuild.build({
        entryPoints: ["index.js"],
        outfile: "out.js",
        watch
    }), esbuild.build({
        entryPoints: ["other.js"],
        outfile: "otherOut.js",
        watch
    })
]).catch(() => 0);

if index.js has an error initially and you then change index.js to fix the error and add something new, esbuild will rebuild it but not print the "Rebuilt". It works as expected if the initial build succeeds

simplescreenrecorder-2022-08-29_18.03.27.mp4
@Vendicated
Copy link
Author

@susiwen8
Copy link
Contributor

#2282

@evanw
Copy link
Owner

evanw commented Aug 29, 2022

Yes, this is a known issue. I'm planning to redesign this API to fix this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants