/elm-webpack-loader

Webpack loader for the Elm programming language.

Primary LanguageJavaScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Elm loader Version Travis build Status AppVeyor build status

Webpack loader for the Elm programming language.

Installation

$ npm install --save elm-webpack-loader

Usage

Documentation: Using loaders

In your webpack.config.js file:

module.exports = {
  module: {
    loaders: [{
      test: /\.elm$/,
      exclude: [/elm-stuff/, /node_modules/],
      loader: 'elm-webpack'
    }]
  }
};

Options

Cache (default false)

You can add cache=true to the loader:

  ...
  loader: 'elm-webpack?cache=true'
  ...

If you add this, when using npm run watch, the loader will only load the dependencies at startup. This could be performance improvement, but know that new files won't be picked up and so won't be watched until you restart webpack.

This flag doesn't matter if you don't use watch mode.

Notes

Example

You can find an example in the example folder. To run:

npm install
npm run build

You can have webpack watch for changes with: npm run watch

You can run the webpack dev server with: npm run dev

noParse

Webpack can complain about precompiled files (files compiled by elm-make). You can silence this warning with noParse. You can see it in use in the example.

  module: {
    loaders: [...],
    noParse: [/.elm$/]
  }