Warning for unused dependencies #5051
Replies: 4 comments
-
|
Dependency code can be called indirectly, with externals, in external code, or its existence can have side effects. Because of these it's not possible to say that the absence of imports is enough to determine that it is unused. This means we couldn't show a warning for dependencies with no imports, as they could be in use. Is there something useful we could still offer here? |
Beta Was this translation helpful? Give feedback.
-
yeah I was afraid that was the case. I'll brainstorm some ideas what else we could offer. |
Beta Was this translation helpful? Give feedback.
-
question though, how could a dependency have side effects without being referenced in any gleam or ffi code? |
Beta Was this translation helpful? Give feedback.
-
|
BEAM packages can have side effects on load, and both JS and BEAM code can be called dynamically. There's also no way for us to be able to tell if a package is statically referenced in external code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
hi!
I couldn't find any issues relating to this, but let me know if I've missed something.
I recently found a couple of just completely unused dependencies in a project of mine and was wondering if this is something we could notify the user about.
So if I have
gleam_javascriptinstalled but nowhere in the program, at any point, Iimport gleam/javascript/..., there would be no benefit to keeping that dependency.Beta Was this translation helpful? Give feedback.
All reactions