2016-11-17 30 views
0

经过几个小时的拉我的头发,我终于有了webpack运行在一个现有的项目,我试图移植到Laravel。Webpack运行,Elixir抛出错误 - undefined不是函数

当我运行的WebPack现在编译...

...但是当我的根,执行药剂运行一饮而尽,我得到这个错误信息:

node_modules /的WebPack/LIB/NullFactory.js:9 undefined是不是一个函数

enter image description here

我webpack.config.js看起来像这样:

var path = require('path'); 
var webpack = require('webpack'); 
var debug = process.env.NODE_ENV !== "production"; 

module.exports = { 
    devtool: 'source-map', 
    entry: debug ? [ 
    'webpack-hot-middleware/client', 
    './resources/assets/js/client/index' 
    ] : [ 
    './resources/assets/js/client/index' 
    ], 
    output: { 
    path: path.join(__dirname, 'public/js'), 
    filename: 'bundle.js', 
    publicPath: '/static/' 
    }, 
    plugins: debug ? [ 
    new webpack.HotModuleReplacementPlugin(), 
    new webpack.NoErrorsPlugin() 
    ] : [ 
    new webpack.optimize.DedupePlugin(), 
    new webpack.optimize.OccurenceOrderPlugin(), 
    new webpack.DefinePlugin({ 
     'process.env': { 
     'NODE_ENV': "'production'" 
     } 
    }), 
    new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false,warnings: false }) 
    ], 
    resolve: { 
    root: [ 
     path.resolve('./resources/assets/js/client') 
    ], 
    alias: { 

    }, 
    }, 
    module: { 
    loaders: [ 
    // js 
    { 
     test: /\.js$/, 
     loaders: ['babel'], 
     include: path.join(__dirname, 'resources/assets/js/client') 
    }, 
    // CSS 
    { 
     test: /\.styl$/, 
     include: path.join(__dirname, 'resources/assets/js/client'), 
     loader: 'style-loader!css-loader!stylus-loader' 
    }, 
    { 
     test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' 
    }, 
    { 
     test: /\.json?$/, 
     loader: 'json' 
    }, 
    { test: /\.html$/, loader: "html" } 
    /* { 
     test: /\.jsx?$/, 
     loader: 'babel', 
     exclude: /node_modules/, 
     query: { 
      cacheDirectory: true, 
      presets: ['react', 'es2015'] 
     } 
     }*/ 
    ] 
    } 
}; 

回答

0

好吧,我有非常过时的版本的节点...升级固定它。

相关问题