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

Incremental mode on errors #1606

Closed
arcanis opened this issue Sep 14, 2021 · 2 comments · Fixed by #2816
Closed

Incremental mode on errors #1606

arcanis opened this issue Sep 14, 2021 · 2 comments · Fixed by #2816

Comments

@arcanis
Copy link

arcanis commented Sep 14, 2021

The rebuild function is only provided when esbuild manages to finish a build. It would be nice if it could instead always return it (even on errors), so that we can decrease the feedback loop when fixing the build.

I tried doing it myself but although it almost works it crashes with the following right after it finishes the rebuild:

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc00010cd58)
        runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc00010cd50)
        sync/waitgroup.go:130 +0x65
main.runService(0x7ffeefbff401)
        github.com/evanw/esbuild/cmd/esbuild/service.go:138 +0x636
main.main()
        github.com/evanw/esbuild/cmd/esbuild/main.go:200 +0x3ae

goroutine 18 [chan receive]:
main.runService.func1(0xc00012e140, 0xc00010cd50)
        github.com/evanw/esbuild/cmd/esbuild/service.go:66 +0x4a
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:64 +0x1fc

goroutine 19 [chan receive]:
main.(*serviceType).sendRequest(0xc00012e140, 0x148ca60, 0xc066251980, 0x7, 0xc066278088)
        github.com/evanw/esbuild/cmd/esbuild/service.go:163 +0x11e
main.runService.func2(0xc00012e140)
        github.com/evanw/esbuild/cmd/esbuild/service.go:92 +0x47
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:89 +0x6ae
@evanw
Copy link
Owner

evanw commented Sep 21, 2021

Yes, this is a known issue. One reason why I haven't done it yet is that it'll take a breaking API change to fix. I'm not totally sure what the best API design is. One approach is of course to have the API call never throw an error and instead return a result object with an error message in the array of logs. However, people will likely not check for it and then write brittle code that fails silently when an error happens. Incremental mode could work differently than non-incremental mode of course but the current consistency between the two is kind of nice. I definitely need to do something though.

Related: #1037 (about watch mode instead of incremental mode, but it's basically the same problem).

@arcanis
Copy link
Author

arcanis commented Sep 21, 2021

Wouldn't attaching rebuild to the thrown error (like I attempted in my diff) work without breaking change?

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.

2 participants