我试图在本地运行 ReactJS + CoffeeScript 应用程序,页面似乎在 JS 中加载,但没有显示任何内容(空白屏幕),控制台中出现错误,显示
Uncaught ReferenceError :通量未定义
这是似乎引发错误的代码片段。 我们将 Flux 作为应用程序中节点模块的一部分。我不知道我应该在这里做什么。
请指导。
dispatcher = new Flux.Dispatcher();
module.exports = dispatcher;
},{}],5:[function(require,module,exports){
var Auth, LoggedInMixin, isEarlyPage, user;
Auth = require('./auth.coffee');
user = require('./stores/user.coffee');
isEarlyPage = function(path) {
return path.substr(1, 5) === 'early' || path.substr(1, 8) === 'settings';
};
module.exports = LoggedInMixin = {
statics: {
willTransitionTo: function(transition) {
if (!user.isLoggedIn()) {
console.error("User not logged in, redirecting.");
return Auth.redirect(transition);
}
if (!user.hasAccess() && !isEarlyPage(transition.path)) {
console.error("User does not have early access, redirecting.");
return transition.redirect('early');
}
}
}
};
},{"./auth.coffee":2,"./stores/user.coffee":11}],6:[function(require,module,exports){
var Constants, Nav, dispatcher, stores;
Constants = require('./constants.coffee');
Nav = require('./views/nav.cjsx');
dispatcher = require('./dispatcher.coffee');
最佳答案
刚刚意识到我的调度程序文件中不需要“flux”。 只需在我的dispatcher.coffee 文件中添加 Flux = require 'flux' 即可解决此问题。
现在面临 React 文件的另一个问题,它给了我这样的错误。
未捕获类型错误:无法读取未定义的属性“createClass”
我知道这是一个 React 问题。
我应该说 react = 需要“ react ” 在每个文件中?
关于javascript - 通量错误: Uncaught ReferenceError: Flux is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27214620/