Use Webpack to compile ELM.
A pure Elm project uses its own toolchain for compilation. I intend to combine ELM with another compile-to-javascript language (probably Typescript). The plan is to use Webpack to combine everthing into a single bundle.
There is an Elm loader for webpack. The documentation even tells you how to configure it. It’s not clear how to add it to an existing project.
This is what I came up with.
- Create a plain JavaScript file named index.js. Set it as your entry.
- In index.js, load your Elm app:
- Add the HtmlWebpackPlugin to your plugins array:
When you run Webpack, it’ll inject the bundle (including index.js) into index.html.
Did this article help?
Sign up for my email newsletter because there's more helpful content on the way!
Did this article help?
Sign up for my email newsletter because there's more helpful content on the way!
blog comments powered by Disqus
Welcome!
Sign up for my email newsletter because there's more helpful content on the way.
Published
13 October 2016