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

A crash happened between switches of branches #3634

Closed
ZuBB opened this issue Feb 7, 2024 · 1 comment
Closed

A crash happened between switches of branches #3634

ZuBB opened this issue Feb 7, 2024 · 1 comment

Comments

@ZuBB
Copy link

ZuBB commented Feb 7, 2024

I was checking some old stuff and was switching branches back and forth. At some moment I looked to next terminal tab where usually I run build and found next

15:26:20: An update from chokidar is about to be triggered
15:26:20: An update from chokidar is about to be triggered
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7a pc=0x1052fcf14]

goroutine 51572 [running]:
github.com/evanw/esbuild/internal/resolver.resolverQuery.tsConfigForDir(...)
        github.com/evanw/esbuild/internal/resolver/resolver.go:1086
github.com/evanw/esbuild/internal/resolver.resolverQuery.resolveWithoutSymlinks({0x14001710480?, 0x140002c0190?, 0x0?, 0x0?}, {0x140000b6450, 0x2d}, 0x0, {0x1400008c480, 0x57})
        github.com/evanw/esbuild/internal/resolver/resolver.go:936 +0x214
github.com/evanw/esbuild/internal/resolver.(*Resolver).Resolve(0x14001710480, {0x140000b6450, 0x2d}, {0x1400008c480, 0x57}, 0x0)
        github.com/evanw/esbuild/internal/resolver/resolver.go:519 +0x1424
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({0x140001b2000?, 0x2, 0x2?}, 0x14001710480?, {0x1400088a0e0, 0x1400000d440, 0x1400000d4d0, 0x140002c7280, 0x4, 0x14000182360}, ...)
        github.com/evanw/esbuild/internal/bundler/bundler.go:961 +0x254
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x8, {{0x1400008c480, 0x57}, {0x0, 0x0}, 0x1})
        github.com/evanw/esbuild/internal/bundler/bundler.go:1798 +0x334
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
        github.com/evanw/esbuild/internal/bundler/bundler.go:1765 +0xa98
^C⏎                                                                                                                                       vv@my-precious ~/work/own/career-partner/source-code $

I am afraid I can't provide a repro. I understand that the above log may not be enough to fix the issue. So I am okay with it just getting closed. I just wanted to report it anyway.

edit: some grammar fixes; esbuild v0.19.12

@evanw
Copy link
Owner

evanw commented Feb 8, 2024

Thanks for the report. I was able to reproduce it with this test case:

require('esbuild').build({
  entryPoints: [],
  bundle: true,
  plugins: [{
    name: 'abc',
    setup(build) {
      build.onStart(() => build.resolve('/foo', {
        kind: 'require-call',
        resolveDir: 'bar',
      }))
    }
  }],
})

Meaning the problem is a crash when resolving a path in a directory that doesn't exist.

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

No branches or pull requests

2 participants