我正在尝试将Ember FastBoot
用于我的应用程序,但是当我运行时:ember fastboot --serve-assets
引发此错误:Cannot read property 'userAgent' of undefinedTypeError: Cannot read property 'userAgent' of undefined at Object.125.global/document (<anonymous>:121923:53) at s (<anonymous>:104896:621) at <anonymous>:104896:672 at Object.106../big-play-button.js (<anonymous>:113849:23) at s (<anonymous>:104896:621) at <anonymous>:104896:672 at Object.139.../../src/js/utils/merge-options.js (<anonymous>:123824:15) at s (<anonymous>:104896:621) at e (<anonymous>:104896:792) at <anonymous>:104896:810
有什么帮助吗?
最佳答案
您发布的回购包含许多对document
和window
的引用。您将必须使用ember provided facility for detecting the current environment
details并根据是否在浏览器中呈现页面来实现条件逻辑。您可以使用environment.hasDOM
进行检查。
关于javascript - Ember FastBoot无法读取未定义的属性“userAgent”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34465266/