1

I'm using webpack with Elm, and find that the watch only survives one set of changes (in fact it will keep on watching as long as the compile phase is successful, but only survives one failed compilation).

I've already tried OldWatchPlugin and increasing the watches (on Ubuntu and OSX).

I'm not at all familiar with webpack (but wanted its hot reloading), so any comments just on my startup ("webpack-dev-server --hot --inline --port 3000") or config (below) would already be helpful.

var webpack = require('webpack');

module.exports = {
    entry: './src/index.js',

    output: {
        path: './dist',
        filename: 'index.js'
    },

    resolve: {
        modulesDirectories: ['node_modules'],
        extensions: ['', '.js', '.elm', '.scss', '.css']
    },

    module: {
        loaders: [
            {
                test: /\.html$/,
                exclude: [/ignore/, /node_modules/],
                loader: 'file?name=[name].[ext]'
            }, {
                test: /\.elm$/,
                exclude: [/ignore/, /elm-stuff/, /node_modules/],
                loader: 'elm-hot!elm-webpack'
            }, {
                test: /\.scss$/,
                exclude: [/ignore/, /elm-stuff/, /node_modules/],
                loaders: ["style", "css", "sass"]
            }, {
                test: /\.css$/,
                exclude: [/ignore/, /elm-stuff/, /node_modules/],
                loaders: ["style", "css"]
            }, {
                // test: /\.(svg|png|jpg)$/,
                test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
                // include: [ /node_modules\/bootstrap-sass/, /src/],
                // exclude: [/ignore/, /elm-stuff/],
                // loader: 'url-loader?limit=10000'
                loader: 'url-loader?limit=10000&name=[name]-[hash].[ext]'
            },  {
                test:/bootstrap-sass[\/\\]assets[\/\\]javascripts[\/\\]/, loader: 'imports?jQuery=jquery'
            }
        ],

        noParse: /\.elm$/
    },
    plugins: [
        new webpack.OldWatchingPlugin()
    ],
    devServer: {
        stats: 'errors-only'
    }
};
Community
  • 1
  • 1
Simon H
  • 20,332
  • 14
  • 71
  • 128
  • Add `new webpack.NoErrorsPlugin()` to plugins section – Bob Sponge Mar 25 '16 at 07:43
  • Thanks for the suggestions, which I tried. But it did not help :-( – Simon H Mar 25 '16 at 16:16
  • No idea what is elm, have this working for angular: config.plugins.push(new webpack.HotModuleReplacementPlugin()); – Petr Averyanov Mar 26 '16 at 15:14
  • i ran into the same problem, which was caused by dirs and filenames to **not** start with an uppercase letter. after renaming everything to match elm's conventions webpack gets the paths to the files to watch right and dutifully updates the browser. – pierrebeitz Apr 09 '16 at 12:22
  • Thanks @pierrebeitz but in my case I did have capitalised directories and filenames already – Simon H Apr 09 '16 at 16:58

1 Answers1

1

This was likely due to a bug which was recently fixed. Upgrading to at least version 3.0.3 should fix things.

tgecho
  • 434
  • 5
  • 6