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

Fix: Avoid compiling Peep.Plug when Plug module is not present #26

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

scudelletti
Copy link
Contributor

Hello there and Happy new year! 🎉

I noticed plug is marked as optional in the mix.exs however the lib doesn't compile when plug is not present.

==> peep
Compiling 18 files (.ex)
    error: module Plug.Conn is not loaded and could not be found
    │
 54 │   import Plug.Conn
    │   ^
    │
    └─ lib/plug.ex:54:3: Peep.Plug (module)


== Compilation error in file lib/plug.ex ==
** (CompileError) lib/plug.ex: cannot compile module Peep.Plug (errors have been logged)

I wrapped Peep.Plug around a conditional(if Code.ensure_loaded?(Plug) so it doesn't try to create that module when plug is not present.

An alternative would be to remove the optional part from the mix.exs.

@scudelletti scudelletti force-pushed the ds-fix-compilation-without-plug branch from 637e9df to a38d6de Compare January 3, 2025 16:10
@rkallos
Copy link
Owner

rkallos commented Jan 3, 2025

Thank you! <3

@rkallos rkallos merged commit 909c18f into rkallos:main Jan 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants