Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

0918nobita/rollup-plugin-elm2

Repository files navigation

rollup-plugin-elm2

Bundle Elm programs with Rollup

Supported Elm version: 0.19

Usage

import Elm from './Main.Elm';

const node = document.getElementById('app');
const app = Elm.Main.init({ node });

rollup.config.js

import elm from 'rollup-plugin-elm2';

const production = !process.env.ROLLUP_WATCH;

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'es',
  },
  plugins: [
    elm({
      exclude: 'elm-stuff/**',
      compiler: {
        optimize: production,
        debug: !production,
      },
    }),
  ],
};

Check the /example for a complete example.

Options

{
  include: [],
  exclude: [],
  compiler: {
    // Enable / Disable compiler optimizations (default: false)
    optimize: true,
    // Enable / Disable debug mode (default: false)
    debug: false,
    // Path to Elm executable (default: elm)
    pathToElm: path.resolve(__dirname, 'node_modules/elm/bin/elm')
  }
}