Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using es6 syntax in an ember-cli (v0.1.12) addon breaks builds and prevents tests from running #3174

Closed
poteto opened this issue Feb 1, 2015 · 5 comments
Labels

Comments

@poteto
Copy link

poteto commented Feb 1, 2015

I'm building an ember-cli addon with v0.1.12, and encountered problems when I use es6 syntax.

As a test, I initialized a new empty ember-addon, and added one component in components/component-name.js. No other changes were made.

  • When using destructuring and es6 syntax in my component:
import Ember from 'ember';

var { computed, get } = Ember;

export default Ember.Component.extend({
  // es6 syntax used here 
});

I get this error:

version: 0.1.12
Build failed.
File: testymctest/components/flash-message
Unexpected token (3:20)
SyntaxError: Unexpected token (3:20)
    at raise (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:333:15)
    at unexpected (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:1366:5)
    at parseIdent (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:2471:7)
    at parsePropertyName (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:2250:78)
    at parseObj (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:2225:9)
    at parseExprAtom (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:2136:14)
    at parseVar (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:1875:57)
    at parseVarStatement (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:1763:5)
    at parseStatement (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:1569:47)
    at parseTopLevel (/Users/lauren/Code/testymctest/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/acorn/acorn.js:1526:18)
  • When I don't use destructuring and use es6 syntax in my component, it builds successfully, but hangs and eventually timeouts:
version: 0.1.12
Built project successfully. Stored in "/Users/lauren/Code/testymctest/tmp/class-tests_dist-fxkpe8Zs.tmp".
  • When running ember test -s with es6 syntax:

screenshot 2015-02-01 22 58 09

  • But when I switch over to plain es5:
import Ember from 'ember';

var computed = Ember.computed;
var get      = Ember.get;

export default Ember.Component.extend({
  // es5 syntax
});

It builds and tests run fine with no es6.

Again, this was tested with a blank addon and only one component file in addon/components/flash-message.js.

@poteto poteto changed the title Using es6 syntax in an ember-addon breaks builds and prevents tests from running Using es6 syntax in an ember-cli addon breaks builds and prevents tests from running Feb 1, 2015
@poteto poteto changed the title Using es6 syntax in an ember-cli addon breaks builds and prevents tests from running Using es6 syntax in an ember-cli (v0.1.12) addon breaks builds and prevents tests from running Feb 1, 2015
@stefanpenner
Copy link
Contributor

thanks for the bug report, we are aware of this one and #3166 will help address this.

@rwjblue
Copy link
Member

rwjblue commented Feb 1, 2015

#3166 addresses the underlying issue. Currently addons cannot use addons to add preprocessor steps (in this case we need ember-cli-6to5 in the addon to preprocess the JS).

stefanpenner added a commit that referenced this issue Mar 15, 2015
…bel does it for us.

* should be faster initial builds
* more sensible experience.
rwjblue added a commit that referenced this issue Mar 15, 2015
[fixes #3520, #3174] disable ES3SafeFilter if babel is present, as babel...
@stefanpenner
Copy link
Contributor

should be fixed now.

@rwjblue
Copy link
Member

rwjblue commented Mar 15, 2015

@poteto - Please test with master and let us know if you run into any issues....

stefanpenner added a commit that referenced this issue Mar 15, 2015
@quantuminformation
Copy link
Contributor

I'm getting this output in the console after upgrading to 2.0 in an addon project:
I'm not clear how to proceed on this.


unit/models/register-test.js: line 14, col 3, 'ok' is not defined.

1 error







ules/acorn-babel/acorn_csp.js:2259:47)
    at parseVarStatement (/Users/me/github/ember-commons/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/node_modules/acorn-babel/acorn_csp.js:2843:5)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants