“过程未定义”-Polymer和Redux错误

gro*_*hjy 2 polymer redux

当我尝试将Redux与Polymer(亮元素)一起使用时,出现以下错误:“未在ad redux.js中定义流程”。如何解决这个错误?

gro*_*hjy 5

我从Polymer的PWA入门工具包中找到了一个破解解决方案。

将此行添加到index.html中:

<script>
  // HACK(keanulee): The Redux package assumes `process` exists - mock it here before
  // the module is loaded.
  window.process = {
    env: {
      NODE_ENV: 'production'
    }
  };
</script>
Run Code Online (Sandbox Code Playgroud)

奇迹般有效。