Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 网页包对象#<;对象>;没有方法';forEach&x27;_Reactjs_Webpack_Babeljs - Fatal编程技术网

Reactjs 网页包对象#<;对象>;没有方法';forEach&x27;

Reactjs 网页包对象#<;对象>;没有方法';forEach&x27;,reactjs,webpack,babeljs,Reactjs,Webpack,Babeljs,我将开始使用react with babel with webpack,但在运行webpack-w之后,它不起作用,并显示如下错误 TypeError: Object #<Object> has no method 'forEach' 我的Main.js文件 var React=require('React'); var Main=React.createClass({ render:function(){ 返回( 你好,世界! ) } }); React.render(,docu

我将开始使用react with babel with webpack,但在运行
webpack-w
之后,它不起作用,并显示如下错误

TypeError: Object #<Object> has no method 'forEach'
我的Main.js文件

var React=require('React');
var Main=React.createClass({
render:function(){
返回(
你好,世界!
)
}
});
React.render(,document.getElementById('app'));

有人能解决这个问题吗?

我们应该为loaders对象指定一个Loader数组

module.exports = {
    entry: "./app/components/Main.js",
    output: {
        filename: "public/bundle.js"
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loaders: ["babel-loader"],
            }
      ],
    },

};

是的,但我需要等17个小时