Webpack看不起作用

时间:2016-03-25 06:43:44

标签: webpack elm webpack-dev-server

我正在使用带有Elm的webpack,并发现手表只能存活一组更改(事实上只要编译阶段成功,它就会继续观看,但只能在编译失败的情况下幸存下来。)

我已经尝试过OldWatchPluginincreasing the watches(在Ubuntu和OSX上)。

我对webpack一点都不熟悉(但希望热重新加载),所以我的启动("webpack-dev-server --hot --inline --port 3000")或配置(下面)上的任何评论都会有所帮助。

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

1 个答案:

答案 0 :(得分:1)

这可能是由于recently fixed的错误造成的。升级到至少版本3.0.3应该可以解决问题。