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

[Bug]: Index out of range error due to ViteJS public import #680

Open
Juricakov opened this issue Apr 29, 2024 · 0 comments
Open

[Bug]: Index out of range error due to ViteJS public import #680

Juricakov opened this issue Apr 29, 2024 · 0 comments
Labels
bug Something isn't working untriaged Requires traige

Comments

@Juricakov
Copy link

Juricakov commented Apr 29, 2024

What happened?

Running JS Gazelle results in an index out of range error when a vite public imports exist in file. See https://vitejs.dev/guide/assets#the-public-directory

You should always reference public assets using root absolute path - for example, public/icon.png should be referenced in source code as /icon.png.

Removing any such imports, ie import viteLogo from '/vite.svg' fixes the problem.

Version

MacOS, Bazel 6.4.0, CLI v5.9.25

How to reproduce

- Bootstrap a new vite project using `npm create vite@latest`
- Run Gazelle

Any other information?

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
aspect.build/cli/gazelle/js.(*Resolver).resolvePackage(0x14000122140, {{0x0, 0x0}, {0x14001d7a870, 0x2d}, {0x14001d01b67, 0x3}, 0x0}, {0x140016a00b0?, 0x104c75444?})
	external/build_aspect_cli/gazelle/js/resolve.go:352 +0x314
aspect.build/cli/gazelle/js.(*Resolver).resolveModuleDep(0x14000122140, 0x14001c29e00, 0x4ae0?, {{{0x1050f7b7f, 0x2}, {0x140016a00b0, 0x9}}, {0x105ba38e0, 0x0, 0x0}, ...}, ...)
	external/build_aspect_cli/gazelle/js/resolve.go:336 +0x3f8
aspect.build/cli/gazelle/js.(*Resolver).resolveModuleDeps(0x105857f90?, 0x14001c29e00, 0x14003709148?, 0x14000a10848, {{0x0, 0x0}, {0x14001d7a870, 0x2d}, {0x14001d01b67, 0x3}, ...})
	external/build_aspect_cli/gazelle/js/resolve.go:217 +0x298
aspect.build/cli/gazelle/js.(*Resolver).Resolve(0x140037091f8?, 0x1050c2fac?, 0x0?, 0x0?, 0x14000e21d80, {0x1057c1d40?, 0x14000a10858}, {{0x0, 0x0}, {0x14001d7a870, ...}, ...})
	external/build_aspect_cli/gazelle/js/resolve.go:188 +0x27c
main.runFixUpdate({0x1400002425a, 0x22}, 0x16b19b231?, {0x1400013e010, 0x0, 0x0})
	external/bazel_gazelle/cmd/gazelle/fix-update.go:442 +0x14f0
main.run({0x1400002425a?, 0x22?}, {0x1400013e010?, 0x1?, 0x1?})
	external/bazel_gazelle/cmd/gazelle/gazelle.go:95 +0x20c
main.main()
	external/bazel_gazelle/cmd/gazelle/gazelle.go:72 +0x104
@Juricakov Juricakov added the bug Something isn't working label Apr 29, 2024
@github-actions github-actions bot added the untriaged Requires traige label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

1 participant