Conventional bundler?

#1

Hello,

I’m new to elm, and want to start working on my first elm project.
What is the recommended way to bundle my project (compile elm, js minification, css, etc)?
What do most people use? Webpack?

Thanks!

1 Like
#2

Hi, take a look at https://www.npmjs.com/package/create-elm-app It have saved me a lot of time to set up bundling etc. You can use it to generate the basic app skeleton and then just eject it and use your own packages, css libraries, tweak webpack etc.

3 Likes
#3

Thanks! I will take a look.

#4

In the link I see a section with many “alternatives”:

  • elm-webpack-starter
  • elm-app-boilerplate
  • elm-hot-loader-starter
  • elm-starter
  • elm-live
  • generator-elmlang

I think it’s a shame there is no one way to do this recommended by the community.
Something like an elm-cli or something… I guess it’ll happen some day :slight_smile:
It’s not enough these days to say “here is how you compile elm to js”. Web developers are looking for a complete solution if they want to consider serious development with a new technology/framework.

Didn’t mean to complain… elm seems like a great technology.
Just sharing my frustration as a newbie

1 Like
#5

Well I take elm-create-app as the “one way to do it” and as such I’m recommending it as it solves most of the needs for setting up a real life project with JS/CSS bundling.

There will always be alternative ways to do the one thing (Grunt/Gulp, Webpack/Browserify/Rollup). It is hard to create the one-suits-all bundler, so it is up to you to find the one that suits you. To be honest I have never needed anything else than elm-create-app as with eject I can cover the edge cases of bundling the project.

3 Likes
#6

ok. Thanks again. It was very helpful!

#7

If you are just starting with elm, why even use any bundler at all?
elm make and elm reactor is enough for the beginning.
Only add a bundler when you really need it, e.g. you need some other js library via npm or you are using sass or similar.
Don’t make your setup complex before you have any need for it!

3 Likes
#8

Thanks. That’s also a good tip.
elm-make won’t minify the javascript though, right?

#9

That’s right. But if you only need that, than maybe just use an npm script and call uglyfy or whatever you use directly.
I’d only switch to a bundler like webpack, gulp, parcel or whatever if it gets more complex.

1 Like
#10

Another option would seem to be parcel. It’s a nice project that is aiming to be faster than Webpack, have zero configuration, and optimize for production. There also seems to be a plugin for Elm, however I’ve never used it personally. So I can’t vouch for how well it works.

1 Like
#11

I’d actually love to use Parcel if anyone has tried it and can vouch for it working decently well right now…

I think there is also a pull request to add standard support for Elm without a needed plugin, but I’m not sure the progress on that.

3 Likes
#12

Depends on what you are doing. If you are starting from scratch, just go with elm-reactor to learn the language.

Once you need an actual website, webpack is still as great as ever, and elm-webpack-loader gives you the excellent live reloading. (That’s what “elm-create-app” is as far as I can tell.) I use this setup on greenfield projects, but webpack configuration does become a bit onerous at times.

I mostly use Elm to enhance existing Rails applications, so I just include the output of elm-make in the Rails asset pipeline.

#13

Thanks everyone.
I started working with elm-create-app and it seems to do everything I need.
I am just starting to learn elm, but I do like to have all those pieces together right from the beginning.

Also, my plan is to develop a progressive-web-application (also learning about that…) so it’s nice elm-create-app already comes configured for that :+1:

1 Like
#14

A bunch of those are the same thing, for what it’s worth, just with different amounts of configuration done for you.

#15

Collin, looks like some good progress has been made with Parcel & Elm:

I’m considering it before diving into webpack. I know webpack will work, but I would love to Parcel is the “zero configuration” feature resulted in less overall complexity.