仅在生产中反应项目错误

时间:2016-11-15 20:10:26

标签: javascript node.js reactjs webpack

我在尝试部署React应用时遇到了一些奇怪的错误。在webpack开发服务器上一切正常,但是当我使用生产设置运行它并让Express服务于index.html文件时如下:

// Production settings
app.use('/api/', routes)
app.get('/', function(req, res) {
  res.sendFile(path.resolve(__dirname, 'index.html'));
});

我收到错误undefined "parsererror" "SyntaxError: Unexpected end of JSON input"Uncaught TypeError: Cannot read property 'length' of undefined

从服务器中提取的一些数据正在出现,有些则不是。几乎所有项目代码都保持不变。

0 个答案:

没有答案
相关问题