I would love to use one code base for an app I’m creating. It needs to run on both web and native mobile (for push notifications).
I’ve enjoyed the routing features introduced with Elm 0.19 and Capacitor seems to be a simple solution for adding native platforms to a project. For those interested, Will Strinz wrote an excellent introduction for using Elm with Capacitor here.
I created the app for web first and then added in Capacitor. As the app was booting in the iOS simulator it errored out because Capacitor attempts to serve the app in iOS from capacitor://localhost
while elm/url
accepts only http
or https
as valid schemes.
This issue addresses the problem. I am so close on this that I don’t want to abandon Capacitor. And I don’t want to give up Elm routing either. My thought is to download elm/url
and elm/browser
locally, make a small update to elm/url
so that it supports the capacitor
scheme and rebuild both locally. However, I encounter this error attempting to compile elm/browser
:
elm make src/Browser.elm
Dependencies loaded from local cache.
Dependencies ready!
elm: Cannot find kernel import of: Browser.Dom
CallStack (from HasCallStack):
error, called at compiler/src/Elm/Kernel.hs:99:9 in main:Elm.Kernel
This makes me wonder if it is even possible to compile core Elm packages locally
Ultimately I have two questions:
- Has anyone been successful running Elm 0.19 with
elm/browser
's routing in Capacitor? - Is it possible to build core Elm components locally?
I would very much like to know how either or both of these can be achieved.
Thank you very much for your time!