mathieuprog / polymorphic_embed

Polymorphic embeds in Ecto
Apache License 2.0
340 stars 62 forks source link

add live_view as optional dependency #97

Closed SteffenDE closed 6 months ago

SteffenDE commented 6 months ago

Hi there, I'm currently in the process of migrating from my fork back to the released version. With 4.0, I noticed that the Component module is not compiled. This is caused by it being marked as only: :test instead of :optional.

Another issue I'm seeing is lots of

14:00:51.656 [warning] Aliases could not be expanded for the given types in MyApp.Foo.Module.

This likely means the types are defined using a module attribute or another reference
that cannot be expanded at compile time. As a result, this may lead to unnecessary
compile-time dependencies, causing longer compilation times and unnecessary
re-compilation of modules (the parent defining the embedded types).

Ensure that the types are specified directly within the macro call to avoid these issues,
or refactor your code to eliminate references that cannot be expanded.

That's another issue for sure, just wanted to let you know.

mathieuprog commented 6 months ago

That's another issue for sure, just wanted to let you know.

That's actually a warning from polymorphic embed, I warn when you use attributes. I guess you use attributes?

I warn because compilation becomes suboptimal, as we then cannot expand the types and we create additional compile-time dependencies.

So I thought I would warn for the developer's best interest.

What do you think?

mathieuprog commented 6 months ago

Could you actually run

mix xref graph --label compile-connected --fail-above 0

to confirm that the attributes lead to compile-time dependencies? Maybe I'm wrong.

SteffenDE commented 6 months ago

@mathieuprog indeed that was my bad. Thank you 😃