Turbopack: fix duplicate module from internal ref (#78194)
A module that was referenced using a `ReferenceType::Internal` and some other non-internal reference type would lead to a duplicated module, because the internal reference always got its own module.
There are various places where we could do the check I added, but this is one of the sources:
https://github.com/vercel/next.js/blob/4509bf240a3327be168ae0035bd578752676b3ec/turbopack/crates/turbopack/src/lib.rs#L501-L504
The bug occured because of these two factors:
- `Option<Vc<Vec<...>>` is just bad at uniquely modelling state (because `None` and `Some(vec![])` really are the same thing but not according to turbo-tasks).
- And then having different two `new` constructors that aren't completely disjoint (with the None vs empty vector case above).