<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="Webpack+React+Hot控制台报错：Cannot read property ‘NODE_ENV’ of undefined" id="card1">
<p> 游客</p><p>
标题:Webpack+React+Hot控制台报错：Cannot read property ‘NODE_ENV’ of undefined<br/>
正文:<br/>
解决办法如下：找到webpack.config.js文件：var webpack = require('webpack');var path = require('path');module.exports = {  // entry: './js/entry.js',  entry: [    'webpack-dev-server/client?http://127.0.0.1:3000', // WebpackDevServer host and port    'webpack/hot/only-dev-server',    './js/index.js' // Your app entry point  ],  output: {    path: __dirname + '/js/',    filename: 'bundle.js',//定义热插拔文件名字    publicPath: '/js/'  },  module: {    loaders: [      { test: /\.css$/, loader: 'style!css' },      { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'},      //{ test: /\.jsx?$/, loaders: ['react-hot', 'babel'], exclude:'/node_modules/' }      { test: /\.jsx?$/, loaders: ['react-hot', 'babel'], include: path.join(__dirname, 'src') }    ]  },  resolve: {    extensions: ['', '.js', '.jsx']  },    postLoaders: [        {test: /intents\//, loader: 'webworker'},        {test: /components\//, loader: 'react-hot', except: /node_modules/}    ]},plugins: [    new webpack.NoErrorsPlugin(),    new webpack<br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2245&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2245&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2245&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2245&amp;Page=2">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=2245">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=2245">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>