运行 编译 JSX 时出现 Reflux 错误,但在使用 transformer 时不会出现 Reflux 错误

React Reflux error when running compiled JSX but not when using transformer

当我将我的 JSX 代码直接包含在脚本标签中时

<script type="text/jsx" src="jsx/components.jsx"></script>

我的反应程序加载并正常工作,但如果我将我的 JSX 编译成 javascript 文件并包含它

<script src="js/components.js"></script>

我收到以下错误

TypeError: listenable is undefined http://localhost/js/reflux.js Line 669

我正在使用以下命令进行编译

jsx -x jsx/ js/

在使用 Reflux 时预编译 JSX 有什么特别需要做的吗?

我终于找到了解决办法。这是我的代码的问题,尽管是一个微妙的问题。 在我的 index.html 中,我按以下顺序加载脚本:

components.js
actions.js
store.js

将组件移到最后修复了错误。

actions.js
store.js
components.js