rescript-lang / rewatch

Rewatch is an alternative build system for the Rescript Compiler.
95 stars 12 forks source link

sourcedirs.rs panics after upgrading from v1.0.4 to 1.0.5 #108

Open vasco3 opened 5 months ago

vasco3 commented 5 months ago

run rewatch clean and rewatch watch. Then i see the following error

> pnpm rewatch watch . 

[1/7] 📦 Built package tree in 0.00s
[2/7] 🕵️  Found source files in 0.00s
[3/7] 📝 Read compile state 0.00s
[4/7] 🧹 Cleaned 0/0 0.00s
[5/7] 🧱 Parsed 120 source files in 0.14s
[6/7] ️🌴 Collected deps in 0.00s
[7/7] 🤺 ️Compiling... ⠂ 122/122                                                        thread 'thread '<unnamed><unnamed>' panicked at src/sourcedirs.rs:26:10:
called `Result::unwrap()` on an `Err` value: StripPrefixError(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
' panicked at src/sourcedirs.rs:26:10:
called `Result::unwrap()` on an `Err` value: StripPrefixError(())
 ELIFECYCLE  Command failed with exit code 101.

I rolled back and it works fine again.

dependencies

rolandpeelen commented 5 months ago

Will have a look into this.

Can you run it with a backtrace with any chance? RUST_BACKTRACE=1 ?

rolandpeelen commented 5 months ago

@vasco3 - Made this optional for now: https://github.com/teamwalnut/rewatch/releases/tag/v1.0.6 -- Release is building.

But - would love to work on fixing this. It looks to me like the path of the package it's trying to resolve is a sub path of another package. Are you able to build Rewatch from source? Ie - If I prepare a branch for you with some debug statements, would you be able to compile it and run it on your repo so we get some debug information?

vasco3 commented 5 months ago

RUST_BACKTRACE=1

like this? (v1.0.6)

image
rolandpeelen commented 5 months ago

Yeah, could be that this doesn't work in release mode. But let's try:

  1. pnpm rewatch clean . - clean state
  2. RUST_BACKTRACE=1 pnpm rewatch build . (this should then spawn the error and hopefully give us a backtrace).

If it doesn't I'll try and prepare a build for you that you can install which will have some more debug info.

vasco3 commented 5 months ago

@rolandpeelen looks like now its working fine? v1.0.6

image
rolandpeelen commented 5 months ago

Hey! Yes, we made them optional. Sorry, should have included the tag. So;

  1. pnpm rewatch clean . - clean state
  2. RUST_BACKTRACE=1 pnpm rewatch --create-sourcedirs true build .
vasco3 commented 4 months ago

@rolandpeelen here is the result

CleanShot 2024-05-07 at 14 04 25@2x

vasco3 commented 4 months ago

running with full CleanShot 2024-05-07 at 14 06 40@2x

rolandpeelen commented 4 months ago

Awesome. Thank you! Ok. there is not that much info there unfortunately. Would you happen to have you have a small public github repo that reproduces this issue?

Alternatively, I can build you a version of Rewatch that does some more logging. But not sure when I can get to that

vasco3 commented 4 months ago

@rolandpeelen yeah I'll put together a repro repo soon

vasco3 commented 4 months ago

@rolandpeelen good news, The sourcedirs error happens when I add @rescript/react

here is the minimal repo https://github.com/vasco3/rewatch-pnpm