ReferenceError: Can't find variable: define at http://localhost:7357/assets/test-loader.js, line 3

断了今生、忘了曾经 提交于 2019-12-10 06:13:26

问题


I'm upgrading my Ember CLI addon from 0.1.9 to 0.2.0, and am hitting this error when running ember test --server:

ReferenceError: Can't find variable: define at http://localhost:7357/assets/test-loader.js, line 3

ember serve works, and I can visit /tests in the browser, but something else seems to have broken the testem/phantom setup.

I've upgraded Phantom, and went through the ember init diffs several times, but I must still be missing something.


回答1:


The problem was I had used ES6 syntax in one of my files in /addon. ES6 isn't supported there (yet), so it was throwing this error.

Removing the ES6 (in this case, back ticks) solved the problem.

Update

Simply npm install --save ember-cli-babel in your addon to get Babel support for the files in your /addon directory.



来源:https://stackoverflow.com/questions/29397189/referenceerror-cant-find-variable-define-at-http-localhost7357-assets-test

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!