Discussion:
[elm-discuss] Rails integrations issues
Peco Danajlovski
2017-06-22 11:06:46 UTC
Permalink
Hi,

I am a RoR developer who recently started to learn Elm. I have a small
application that I integrated with Rails 5.1 through Webpacker plugin.
However when running webpack I noticed that all elm files are compiled
instead of just Main, and that makes things really, really slow. So my
question, is it possible to configure webpack just to use the main elm file
and if yes how to do that?

Cheers,
Peco
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
N H
2017-06-23 09:52:20 UTC
Permalink
Can you expand a bit what you mean by "all elm files are compiled"?
Every file needs to be compiled in order for Elm to generate the right
javascript.
Post by Peco Danajlovski
Hi,
I am a RoR developer who recently started to learn Elm. I have a small
application that I integrated with Rails 5.1 through Webpacker plugin.
However when running webpack I noticed that all elm files are compiled
instead of just Main, and that makes things really, really slow. So my
question, is it possible to configure webpack just to use the main elm file
and if yes how to do that?
Cheers,
Peco
--
You received this message because you are subscribed to the Google Groups
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Peco Danajlovski
2017-07-13 15:02:25 UTC
Permalink
Ok, so what I wanted to say is that compressed js was created for every
.elm file that was in the packs directory so in the end I had like 20
generated js files with sizes up to 2MB, imagine that it took like 100
seconds for that. :)

But, after posting the same issue in the rails webpacker github, I got the
answer and solution. Apparently the elm files shouldn't be in packs
directory, because webpacker checks everything there and tries to compile
it. What I did was isolate my app outside of packs dir and reference it
from application.js file.
Post by N H
Can you expand a bit what you mean by "all elm files are compiled"?
Every file needs to be compiled in order for Elm to generate the right
javascript.
Post by Peco Danajlovski
Hi,
I am a RoR developer who recently started to learn Elm. I have a small
application that I integrated with Rails 5.1 through Webpacker plugin.
However when running webpack I noticed that all elm files are compiled
instead of just Main, and that makes things really, really slow. So my
question, is it possible to configure webpack just to use the main elm
file
Post by Peco Danajlovski
and if yes how to do that?
Cheers,
Peco
--
You received this message because you are subscribed to the Google
Groups
Post by Peco Danajlovski
"Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Peco Danajlovski
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Fabian Kirchner
2017-06-23 11:07:52 UTC
Permalink
Hi Peco,

I recently ran into the same issue. What I did was create a seperate
directory for my elm app inside app/javascript (next to the packs folder
where the example Main.elm was inside) and only put the javascript file
which initializes elm into the folder app/javascript/packs. You then need
to change the import Elm from... line to sth like

import Elm from 'YourNewAppFolder/Main'

and add app/javascript/YourNewAppFolder to the list of src directories in
elm-package.json (which lies inside your rails root). Then webpack should
only compile Main.elm and let elm-make decide which other sources to
compile.

I hope that helps :)
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Max Goldstein
2017-06-24 11:41:51 UTC
Permalink
Assuming that works as described, you should think about sending a PR upstream.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Fabian Kirchner
2017-06-25 11:06:40 UTC
Permalink
You mean, the webpacker gem should create an example elm-app using the
folderstructure I tried?
Post by Max Goldstein
Assuming that works as described, you should think about sending a PR upstream.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...