问题
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