ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

Getting an exception thrown, "Unexpected token default" #35

Closed devinus closed 9 years ago

devinus commented 9 years ago

Not sure how to debug this:

Line 1: Unexpected token default
Error: Line 1: Unexpected token default
    at throwError (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:2129:21)
    at throwUnexpected (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:2183:13)
    at parseVariableIdentifier (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:3341:13)
    at parseExportSpecifier (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:3467:14)
    at parseExportDeclaration (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:3504:33)
    at parseProgramElement (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:4670:24)
    at parseProgramElements (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:4712:29)
    at parseProgram (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:4759:16)
    at Object.parse (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/node_modules/esprima/esprima.js:5235:23)
    at parseImports (/Users/devin/Projects/rebelmail-dashboard/node_modules/ember-browserify/lib/stub-generator.js:116:23)
devinus commented 9 years ago

This is only after doing npm install --save-dev ember-browserify and attempting to restart the app.

asakusuma commented 9 years ago

So this error happened before you added any import npm:my-module statements?

asakusuma commented 9 years ago

Also, can you confirm that you are on the latest version of ember-browserify? The fact that your stack trace goes through esprima seems to indicate that this might be using an old verison.

theworkerant commented 9 years ago

I had to clear my cache. npm cache clear

devinus commented 9 years ago

@asakusuma The latest version of ember-browserify is 1.0.0 which still uses Esprima.

edymerchk commented 9 years ago

Similar thing happen to me trying to use this: https://github.com/csantero/ember-sinon, the file where Esprima fails is this one: https://github.com/csantero/ember-sinon/blob/master/app/acceptance-tests/sinon.js

using master version of ember-browserify works well

"ember-browserify": "ef4/ember-browserify",

@ef4 can yo bump to 1.0.1 so this commit https://github.com/ef4/ember-browserify/commit/7499952d1e1663f57785de58d3090725ea943230 goes to the new version

miguelcobain commented 9 years ago

:+1: on bumping.

asakusuma commented 9 years ago

@devinus can you upgrade to 1.0.1 and see if that fixes the issue?

devinus commented 9 years ago

@asakusuma It does not. I unfortunately am using Babel features using the babel key for things like https://github.com/rwjblue/ember-computed-decorators.

asakusuma commented 9 years ago

@devinus can you post the new stack trace? It's should be different since 1.0.1 uses acorn instead of esprima.

asakusuma commented 9 years ago

@devinus any update on this? If not I will close.

devinus commented 9 years ago

@asakusuma This is no longer a problem.