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] Infinite loop when building with vite #854

Open
oleh-nb opened this issue Feb 14, 2024 · 3 comments
Open

[Bug] Infinite loop when building with vite #854

oleh-nb opened this issue Feb 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@oleh-nb
Copy link

oleh-nb commented Feb 14, 2024

🐛 Bug Report

Building a project with vite build hangs because of an infinite resolution loop.

Steps to Reproduce

git clone https://github.com/oleh-nb/aleo-bug-infinite-loop.git
cd aleo-bug-infinite-loop
npm install
npm run build

Check the logs. They should look like this

Code snippet to reproduce

import { ProgramManager } from "@aleohq/sdk";
new ProgramManager();

Stack trace & error message

Click to expand
  vite:resolve 0.06ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +261ms
  vite:resolve 0.28ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.26ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.24ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +495ms
  vite:resolve 0.30ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.34ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.67ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +634ms
  vite:resolve 0.66ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.23ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.17ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +645ms
  vite:resolve 0.25ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.42ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.33ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +752ms
  vite:resolve 0.49ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.19ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +651ms
  vite:resolve 0.23ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.38ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.25ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +642ms
  vite:resolve 0.40ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.24ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.22ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +647ms
  vite:resolve 0.34ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.18ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.21ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +669ms
  vite:resolve 0.41ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.19ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.31ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +672ms
  vite:resolve 0.37ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.21ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +704ms
  vite:resolve 0.21ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.37ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.18ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +653ms
  vite:resolve 0.46ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.23ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +660ms
  vite:resolve 0.37ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.25ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.21ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +740ms
  vite:resolve 0.27ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.38ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.19ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +660ms
  vite:resolve 0.37ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.23ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.24ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +677ms
  vite:resolve 0.61ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.16ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +643ms
  vite:resolve 0.39ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.20ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.23ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +746ms
  vite:resolve 0.45ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.21ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +679ms
  vite:resolve 0.48ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.23ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.13ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +692ms
  vite:resolve 0.52ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.37ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.25ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +686ms
  vite:resolve 0.38ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.21ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +666ms
  vite:resolve 0.39ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.22ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.24ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +675ms
  vite:resolve 0.25ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.35ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.24ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +662ms
  vite:resolve 0.53ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.21ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms
  vite:resolve 0.18ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +678ms
  vite:resolve 0.30ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.19ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms

Expected Behavior

Project should be built

Your Environment

  • Aleo SDK Version: 0.6.9
  • Rust Version: cargo 1.75.0 (1d8b05cdd 2023-11-20)
  • Computer OS: macos 14.2.1
@oleh-nb oleh-nb added the bug Something isn't working label Feb 14, 2024
@onetrickwolf
Copy link
Collaborator

Hey I believe this was a bug in vite: vitejs/vite#13367

They allegedly fixed it in version 5.

@olehmisar
Copy link

Its either not fixed or it's a different bug. I am pretty sure it's a different bug. Any idea where or why this bug occurs?

Its something related to these three files

vite:resolve 0.06ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/worker.js +261ms
  vite:resolve 0.28ms worker.js -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/sdk/dist/worker.js +0ms
  vite:resolve 0.26ms assets/aleo_wasm.wasm -> /Users/oleh-nb/Documents/Projects/aleo/bug/node_modules/@aleohq/wasm/dist/assets/aleo_wasm.wasm +0ms

@onetrickwolf onetrickwolf self-assigned this Feb 14, 2024
@onetrickwolf
Copy link
Collaborator

Hmm I'll take a look pretty sure this is an issue with vite though seems like a similar issue and I don't see anything weird in our code. Looks like it's something to do with how vite handles nested workers which we do use.

I'll see if I can replicate in a simple example and report it to vite. I previously spent a lot of time on this and was unable to find a workaround, was waiting for them to fix it but if I find something I'll let you know. In our examples the temporary solution was to use webpack for the builds while using vite for dev but I know that's not ideal. Sorry about any inconvenience. Will try to figure something out here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants