Yet another Webpack loader for the Elm programming language.
It's written with the following goals in mind:
- Work primarily with Webpack v4 and Elm 0.19, don't try and be backwards compatible.
- Work robustly and provide useful errors - hence it's actually written in Purescript. This is more important to me than performance.
- Zero assumptions. Anything uncertain is passed in via
options
. - Zero
npm
dependencies.
Just about every combination of elm
, webpack
, and loader
is taken on npm
. So this will live on Github for the forseeable future.
package.json
{
"name": "your-thing"
...
"dependencies": {
...
"elm-loader": "jmackie/elm-loader#0.3.0"
...
}
}
webpack.config.js
module.exports = {
...
module: {
rules: [
{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
use: [
{
loader: 'elm-loader',
options: {
compiler: 'elm', // use `elm` on PATH
debug: true, // --debug
watch: true, // running in watch mode
},
},
],
},
],
},
};
Path to the elm
compiler binary. This becomes the command
argument to child_prcess.spawn
.
If set to true
the --debug
flag will be passed to elm make
If set to true
the --optimize
flag will be passed to elm make
If set to true
all elm file dependencies will be registered with Webpack.
Optional working directory in which to run.
Optional function to be executed before compilation starts. You can use this for logging.
Optional function to be executed after compilation finishes. You can use this for logging