@Uriah
To deploy to shinyapps.io you need to have the package installed, and you need to load it in your script using library. This way, when publishing, the process can find the dependencies and asked for them on the deployment server. If you don't put library(leaflet) somewhere, it can't guess that leafletOutput requires leaflet package and your app won't work on the server.
You can test locally by opening a new clean session and run your app. If there is no error, it should work, providing you send the same files on the server.
hope it helps understand the why.