Coder Social home page Coder Social logo

vic / elm-webpack-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elm-community/elm-webpack-loader

0.0 2.0 0.0 47 KB

Webpack loader for the Elm programming language.

License: BSD 3-Clause "New" or "Revised" License

Elm 2.18% HTML 3.50% JavaScript 94.33%

elm-webpack-loader's Introduction

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'
    }]
  }
};

See the examples section below for the complete webpack configuration.

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.

cwd (default null)

You can add cwd=elmSource to the loader:

var elmSource = __dirname + '/elm/path/in/project'
  ...
  loader: 'elm-webpack?cwd=' + elmSource
  ...

You can use this to specify a custom location within your project for your elm files. Note, this will cause the compiler to look for all elm source files in the specified directory.

Upstream options

All options are sent down as an options object to node-elm-compiler. For example, you can explicitly pick the local elm-make binary by setting the option pathToMake:

  ...
  loader: 'elm-webpack?pathToMake=node_modules/.bin/elm-make',
  ...

For a list all possible options, consult the source.

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

For a full featured example project that uses elm-webpack-loader see pmdesgn/elm-webpack-starter .

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$/]
  }

Revisions

2.0.0

Change warn to be a pass-through compiler flag rather than a way to specify logging behavior.

1.0.0

Initial stable release.

elm-webpack-loader's People

Contributors

eeue56 avatar unindented avatar tcoopman avatar rapind avatar rtfeldman avatar codedmart avatar dennisreimann avatar dynajoe avatar igrep avatar terakilobyte avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.