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

Don't add analyze plugin when buildOptions == nil #3373

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mateusz834
Copy link

This should fix a panic when using the --analyze CLI option.
Examples:

[mateusz@arch esbuild (fix-analyze-cli-panic)]$ ./esbuild --analyze
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2f8 pc=0x8a5f09]

goroutine 1 [running]:
github.com/evanw/esbuild/pkg/cli.addAnalyzePlugin(...)
        /home/mateusz/code/esbuild/pkg/cli/cli_impl.go:1107
github.com/evanw/esbuild/pkg/cli.runImpl({0xc000024070, 0x1, 0x1})
        /home/mateusz/code/esbuild/pkg/cli/cli_impl.go:1145 +0x409
github.com/evanw/esbuild/pkg/cli.Run(...)
        /home/mateusz/code/esbuild/pkg/cli/cli.go:31
main.main.func1({0x0?, 0xc00004c638?}, {0xc000024070?, 0x1, 0x1}, {0x0?, 0x0?}, {0x0, 0x0}, 0xc00013fea0, ...)
        /home/mateusz/code/esbuild/cmd/esbuild/main.go:361 +0x4cf
main.main()
        /home/mateusz/code/esbuild/cmd/esbuild/main.go:363 +0x9ac

[mateusz@arch esbuild (fix-analyze-cli-panic)]$ ./esbuild index.js --outfile=out.js --analyze --bundle --unknownOpt
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2f8 pc=0x8a5f09]

goroutine 1 [running]:
github.com/evanw/esbuild/pkg/cli.addAnalyzePlugin(...)
        /home/mateusz/code/esbuild/pkg/cli/cli_impl.go:1107
github.com/evanw/esbuild/pkg/cli.runImpl({0xc0000241f0, 0x5, 0x5})
        /home/mateusz/code/esbuild/pkg/cli/cli_impl.go:1145 +0x409
github.com/evanw/esbuild/pkg/cli.Run(...)
        /home/mateusz/code/esbuild/pkg/cli/cli.go:31
main.main.func1({0x0?, 0xc00004e638?}, {0xc0000241f0?, 0x5, 0x5}, {0x0?, 0x0?}, {0x0, 0x0}, 0xc00017fea0, ...)
        /home/mateusz/code/esbuild/cmd/esbuild/main.go:361 +0x4cf
main.main()
        /home/mateusz/code/esbuild/cmd/esbuild/main.go:363 +0x9ac

@mateusz834 mateusz834 changed the title Don't add analyze pluign when buildOptions == nil Don't add analyze plugin when buildOptions == nil Sep 10, 2023
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 this pull request may close these issues.

None yet

1 participant